<input name="met.category"/>这个文本框的value如何获取? <input name="met.category"/>这个文本框没有id,只有name,如何通过name获取value呢?求高人指点 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $("input:[name='met.category']").val() document.getElementsByName("met.category")[0].value;这样不就取到了吗? 但如果不用数组的方式取,就用getElementbyname能取到吗? <!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 src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript"></script> <script type="text/javascript"> function test(){ alert(document.myForm.txtTest.value); } </script></head><script></script><body><form name="myForm" ><input type="text" name="txtTest" value="123" /><input type="button" onclick="test()" value="测试" /></form></body></html> 用jQuery方式取值很方便啊jQuery("[name='met.category']").val(); 关于谷歌地图V3的标注问题,求高手,保工作- - JavaScript中有绘制一组像素的函数吗? js如何去掉html中的文本框(表单) JS实现双击table中的某一行,跳转到另一个页面 求适合初学者的javascript编辑工具 radiogroup的问题 动态显示下拉框的一段代码的错误,求教! 问:想要鼠标滑到某张图片或文字上是显示注解。怎么弄? jsp能接受javascript传来的值吗? 哪里有Javascript的chm函数手册?40分相送 highcharts的问题 页面回访【求教】
这样不就取到了吗?
<!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 src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
function test(){
alert(document.myForm.txtTest.value);
}
</script>
</head>
<script>
</script>
<body>
<form name="myForm" >
<input type="text" name="txtTest" value="123" />
<input type="button" onclick="test()" value="测试" />
</form>
</body>
</html>
jQuery("[name='met.category']").val();