thaiall logomy background
coding : j0702.java.
my town
Source : Perl | PHP | ASP | JSP | HTML | HTML5 | JavaScript | Java | COBOL | C++ | MS Access | VBNet | VB | Python | โค้ดดี
File : j0702.java. ID : j0702
Skin : Default | Sons-of-obsidian | Sunburst | Highlighter | Full
// program id : 30
// 1. อ่านข้อมูลจาก data.txt เขียนลง data.htm 
// 2. นำข้อมูลที่ถูกแยกด้วย , เขียนลง table อย่างเป็นระเบียบ
// 3. DOS>explorer data.htm
// 4. ต.ย. <input type=radio onclick={alert("a");}>
import java.io.*;
import java.lang.*;
public class j0702 {
  public static void main (String args[]) throws IOException {
    int i = 1;
    String b;
    String[] fields;
    String patternStr = ",";
    FileReader fin = new FileReader("data.txt");
    BufferedReader bin = new BufferedReader (fin);
    FileOutputStream fout = new FileOutputStream("data.htm");
    BufferedOutputStream bout = new BufferedOutputStream(fout);
    PrintStream pout = new PrintStream(bout);
    pout.println("<body bgcolor=yellow><table border=1 width=100%>");
    while ((b =  bin.readLine()) != null) {
      fields = b.split(patternStr);
      pout.println("<tr>");
      pout.println("<td>"+i+"</td>");
      pout.println("<td>"+"ID = " + fields[0]+"</td>");
      pout.println("<td>"+"Name = " + fields[1]+"</td>");
      pout.println("<td>"+"Salary = " + fields[2]+"</td>");
      pout.println("<td>"+"Status = " + fields[3]+"</td>");
      pout.println("</tr>");
      i = i + 1;
    }
    pout.println("</table></body>");
    fin.close();
    pout.close();
  }
}
จำนวน : 35 บรรทัด
าษาเฮชทีเอ็มแอล (HTML = HyperText Markup Language) คือ ภาษาคอมพิวเตอร์ที่ออกแบบมาเพื่อใช้ในการสร้างเว็บเพจที่เรียกดูผ่านทางเว็บเบราว์เซอร์ (Web Browser) เริ่มพัฒนาโดย ทิม เบอร์เนอรส์ ลี (Tim Berners Lee) ในปัจจุบัน HTML ล่าสุดคือ รุ่น 5 เป็นมาตรฐานหนึ่งของ ISO ซึ่งจัดการโดย World Wide Web Consortium (W3C) ในปัจจุบัน ทาง W3C ผลักดัน รูปแบบของ HTML แบบใหม่ ที่เรียกว่า XHTML รุ่นแรกคือ 1.0 (ม.ค.2543) ซึ่งมีโครงสร้างเป็นแบบ XML (eXtensible Markup Language)
ตัวอย่าง Hello World
ปรับปรุงโปรแกรม source.pl : 2565-07-24
rspsocial
Thaiall.com