j**ascript如何取得文本框的值

时间:浏览115次 发布人:arescheng

j**ascript如何取得文本框的值

已解决问题

谷歌arescheng用户在浏览115次提交了关于“盛泽镇j**ascript如何取得文本框的值”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-08-10T22:50:12。是用GetWindowText这个函数吗
<html>
<formname="form1"method="post"action="">
<tablewidth="400"border="0">
<tr>
<tdwidth="20%">文件名:</td>
<td><textareaname="filename"cols="50"rows="10"></textarea>
</td>
</tr>
<tr>
<tdwidth="100">文件路径:</td>
<td><inputtype="text"name="filepath"></td>
</tr>
<tr>
<td><inputname="Input"type="button"value="更新"onClick="test()"></td>
<td><inputname="重置"type="reset"value="重设"></td>
</tr>
</table>

</form>

<scriptlanguage="j**ascript">
functiontest()
{
form=form1;
varname=form.filename.GetWindowText;
varpath=form.filepath.GetWindowText;
varstr=name+path;
alert(str);
}

</script>
</html>
当我执行以上代码时,出的对话框老是出现“Nan”,为什么啊。希望大家能够帮助她。

详细问题描述及疑问:是用GetWindowText这个函数吗
<html>
<formname="form1"method="post"action="">
<tablewidth="400"border="0">
<tr>
<tdwidth="20%">文件名:</td>
<td><textareaname="filename"cols="50"rows="10"></textarea>
</td>
</tr>
<tr>
<tdwidth="100">文件路径:</td>
<td><inputtype="text"name="filepath"></td>
</tr>
<tr>
<td><inputname="Input"type="button"value="更新"onClick="test()"></td>
<td><inputname="重置"type="reset"value="重设"></td>
</tr>
</table>

</form>

<scriptlanguage="j**ascript">
functiontest()
{
form=form1;
varname=form.filename.GetWindowText;
varpath=form.filepath.GetWindowText;
varstr=name+path;
alert(str);
}

</script>
</html>
当我执行以上代码时,出的对话框老是出现“Nan”,为什么啊。期待您的答案,真心佩服你,谢谢 !

希望以下的回答,能够帮助你。

第1个回答

用户名:oowz1银盟志液稳干子39qrk  

<scriptlanguage="并慧顷j**ascript">绝陆
func两照几万间陈费tiontest()
{

v按城报侵浓派探计arname=documen化查老t.form1.filename.value;
varpath=document.fo欢转文开研委集想也rm1.value;
varstr=name+path;
alert(str);
}

</碧铅scr庆之几英技员盟ipt>