今天上午问了问题,下午解决了,现在发现出了一点小问题。<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title> <script src="../js/jquery-vsdoc.js" type="text/javascript"></script> <script src="../js/jquery.js" type="text/javascript"></script></head>
<body>
<a title="asdf" href="#">asdf</a><a title="qwer" href="#">qwer</a><a title="zxcv" href="#">zxcv</a><input id="txtValue" type="text" />
</body>
<script>
$('a').click(function() {
$("#txtValue").val($(this).attr("title"));
})
</script>
</html>就这个, 这个好象是整个页面的所有<a>都受到了控制,我只想让指定的某几个<a>链接产生这种效果,其他<a>不受这个js影响。 怎么弄啊。 怪我问问题时候没考虑清楚。
<head runat="server">
<title></title> <script src="../js/jquery-vsdoc.js" type="text/javascript"></script> <script src="../js/jquery.js" type="text/javascript"></script></head>
<body>
<a title="asdf" href="#">asdf</a><a title="qwer" href="#">qwer</a><a title="zxcv" href="#">zxcv</a><input id="txtValue" type="text" />
</body>
<script>
$('a').click(function() {
$("#txtValue").val($(this).attr("title"));
})
</script>
</html>就这个, 这个好象是整个页面的所有<a>都受到了控制,我只想让指定的某几个<a>链接产生这种效果,其他<a>不受这个js影响。 怎么弄啊。 怪我问问题时候没考虑清楚。
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js"></script></head>
<body>
<a class="ab" title="asdf" href="#">asdf</a><a class="ab" title="qwer" href="#">qwer</a><a title="zxcv" href="#">zxcv</a><input id="txtValue" type="text" />
</body>
<script>
$('a.ab').click(function() {
$("#txtValue").val($(this).attr("title"));
})
</script>
</html>
$(a[name='name1']).click(function(){});
$('.test').click(function() {
$("#txtValue").val($(this).attr("title"));
})
</script>