<a value='www.jzhpeng1.com' href="#" onclick="Message_select(this.value)">//更改为试试<td height="50" align="center"> <a value="www.jzhpeng3.com" href="#" onclick="javascript:Message_select(this.value)">网站3 </a>
解决方案 »
- div 模拟selectjquery点击选取当前和离开隐藏问题在线求解啊
- 象这样的js脚本谁写的出来.
- 求一高难度的正则表达式
- 创建activex控件失败
- document.createElement方法生成的Div如何添加事件?
- js中window和document有何区别
- fason、meizz请进,关于fason的网站上bigarea\script\area.js
- javascript文本操作问题,太简单,就是不知道
- 请问为什么我替换后回车符号后,却不是很正确,而且不能返回到另一个textarea里面了,请看我的例子代
- jquery效果,PC和移动端通用,上下滑动/拖动,切出的模块缩放,切入的模块正常,如图所示。
- jquery调用页面嵌套加载问题
- 请帮我看看什么问题!谢!
<head>
<link href="http://localhost/css/all.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档 </title>
<script type="text/javascript">
function Message_select(obj)
{
var value=obj.getAttribute("value");alert(value);
}
</script>
</head> <body>
<br />
<br />
<table width="150" border="1" cellspacing="0">
<tr>
<td height="50" align="center"> <p> <a value='www.jzhpeng1.com' href="#" onclick="Message_select(this)">网址1 </a> </td>
</tr>
<tr>
<td height="50" align="center"> <p> <a href="#" value="www.jzhpeng2.com" onclick="Message_select(this)">网址2 </a> </td>
</tr>
<tr>
<td height="50" align="center"><a value="www.jzhpeng3.com" href="#" onclick="javascript:Message_select(this)">网址3 </a> </td>
</tr> </table>
</body>
</html>
ie是支持形如document.all.id的,但这并非w3c标准,ff在这里跟ie不一样。所以需要用getAttribute来取value2楼的this表示点击时,触发点击的元素,即a标签
<head>
<link href="http://localhost/css/all.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档 </title>
<script type="text/javascript">
function Message_select(value)
{
alert(value);
}
</script>
</head> <body>
<br />
<br />
<table width="150" border="1" cellspacing="0">
<tr>
<td height="50" align="center"> <p> <a value='www.jzhpeng1.com' href="#" onclick="Message_select(this.innerHTML)">网址1 </a> </td>
</tr>
<tr>
<td height="50" align="center"> <p> <a value='www.jzhpeng2.com' href="#" onclick="Message_select(this.innerHTML)">网址2 </a> </td>
</tr>
<tr>
<td height="50" align="center"> <a value='www.jzhpeng3.com' href="#" onclick="Message_select(this.innerHTML)">网址3 </a> </td>
</tr> </table>
</body>
</html>