js 小问题,大家来看下

passself passself 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

<!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=utf-8" />
<title>js测试</title>
<script src="jquery-1.3.2.js"></script>
<script>
$(document).ready(function(){

});
</script>
<script>
function test(e,id){
var temp_id = id;
alert(id)
var temp = document.form1.txt1.value;//txt1非变量
alert("非变量的值为:"+temp)
var temp1 = document.form1.temp_id.value;//这里得到的id为txt1会报错怎么回事?
alert(temp1)
}
</script>
</head>
<body>
<form id="form1" name="form1">
<input id="txt1" name="text1" onkeydown="test(event,$(this).attr('id'));" /><br />
<input id="txt2" name="text2" onkeydown="test(event,$(this).attr('id'))"/>
</form>
</body>
</html>

...全文
评论 20
收藏 已收藏
分享
返回顶部
passself
JavaScript 87,983 成员 224,681 内容