ผมต้องการสร้าง funtion onload ใน html เพื่อไปใช้งานในการ set defaut value ของ textarea
ขอวิธีการเขียน java script หน่อยยครับ
ผมลองเขียนแล้วมันไม่ทำงาน
JS
โค้ด: เลือกทั้งหมด
<script>
function def_load(){
var x = document.getElementsByName("rml").value ="example";
}
</script>
HTML
โค้ด: เลือกทั้งหมด
<td width="50%">Code<textarea rows="25" cols="170" onload="def_load();" type ="text" name="rml"></textarea></td>
ผมต้องการสร้าง funtion onload ใน html เพื่อไปใช้งานในการ set defaut value ของ textarea
ขอวิธีการเขียน java script หน่อยยครับ
ผมลองเขียนแล้วมันไม่ทำงาน
JS
[code]<script>
function def_load(){
var x = document.getElementsByName("rml").value ="example";
}
</script>[/code]
HTML
[code]
<td width="50%">Code<textarea rows="25" cols="170" onload="def_load();" type ="text" name="rml"></textarea></td>
[/code]