<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <script language="JavaScript"> function fncChkSize1() { var ele = document.getElementById("txtA"); alert (ele.size) } function fncChkSize2() { var ele = document.getElementById("txtB"); alert (ele.style.width) } </script> <body> <form name="frmMain" method="post"> <input name="txtA" size="50" type="text" id="txtA" value=""> <input name="chkSize1" type="button" id="chkSize1" onClick="Javascript:fncChkSize1();" value="Check Size"> <hr> <input name="txtB" type="text" id="txtB" value="" style="width:100px"> <input name="chkSize2" type="button" id="chkSize2" onClick="Javascript:fncChkSize2();" value="Check Size"> </form> </body> </html>
<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <body> <script language="JavaScript"> function fncFixedSize1() { var ele = document.getElementById("txtA"); ele.size = 100; alert (ele.size) } function fncFixedSize2() { var ele = document.getElementById("txtB"); ele.style.width = "100px"; alert (ele.style.width) } </script> <body> <form name="frmMain" method="post"> <input name="txtA" type="text" id="txtA" value=""> <input name="fixedSize1" type="button" id="fixedSize1" onClick="Javascript:fncFixedSize1();" value="Fixed Size"> <hr> <input name="txtB" type="text" id="txtB" value=""> <input name="fixedSize2" type="button" id="fixedSize2" onClick="Javascript:fncFixedSize2();" value="Fixed Size"> </form> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท