可共用:

IE可用:

  • obj.msg, obj['msg']
[SCRIPT]
function fnTest() {
  var obj = document.getElementById('txtStr');
  var msg = obj.getAttribute("msg");
  print(obj.id+'='+obj.value+','+msg );
}
[/SCRIPT]

[BODY]
<form>
<input type="text" id="txtStr" value="123-Abc" msg="測試" />
<input type="button" id="btnSave" value="TEST" onclick="fnTest();"/>
<br />
<div id="divMsg">divMsg</div>
</form>
[/BODY]