<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><script language="javascript" type="text/javascript"> function showMsg(){ document.getElementById("textfield").value=document.getElementById("textfield").width;} </script></head><body> <input type="submit" name="Submit" value="提交"id="Submit" onclick="showMsg()" /> <input type="text" style="width:100px;" id="textfield" name="textfield" /></body></html>
document.getElementById("textfield").width
--》
document.getElementById("textfield").style.width
document.getElementById("textfield").width
--》
document.getElementById("textfield").style.width
function showMsg(){ var x=document.getElementById("textfield").style.width; var y=x.split("px"); document.getElementById("textfield").value=y[0];}
function showMsg(){ var x=document.getElementById("textfield").style.width; var y=x.split("px"); document.getElementById("textfield").value=y[0];}
function showMsg(){ var x=document.getElementById("textfield").style.width; var y=x.split("px"); document.getElementById("textfield").value=y[0];}
document.getElementById("textfield").width
--》
document.getElementById("textfield").style.width