<script language="JavaScript">
<!--
function getInput(){
alert(document.frm["test"].value)
}
//-->
</script>
<form name="frm" action="XXX">
<input name="test" type="text" value="hehe"/>
<a href="" onClick="getInput();return(false)">
<img border="0" src="../images/btnhelp.gif"/>
</a>
</form>
<!--
function getInput(){
alert(document.frm["test"].value)
}
//-->
</script>
<form name="frm" action="XXX">
<input name="test" type="text" value="hehe"/>
<a href="" onClick="getInput();return(false)">
<img border="0" src="../images/btnhelp.gif"/>
</a>
</form>
<input name="test" type="text" value=""/>
<a onClick="alert(document.formName.test.value);">
<img border="0" src="../images/btnhelp.gif"/>
</a>
</form>
2、document.all.控件名.value
3、document.all.控件ID.value你使用第一种就可以了。
<a onClick="JavaScript:alert(document.XXX.test.value);">
<input name()="test" type="text" value=""/>//这name写错了写成name()
<a onClick="alert(test.value)">
<img border="0" src="../images/btnhelp.gif"/>
</a>
</form>