首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

怎么只触发这样的效果

2013-09-05 
如何只触发这样的效果li onclickshow()a onclickshowtime()确定/ali现在点击确定时会同时触

如何只触发这样的效果
<li onclick="show()"><a onclick="showtime()">确定</a><li>
现在点击确定时会同时触发2个事件,要怎样才能点确定只触发showtime,
注:show()这个方法也有用,不能删除 jquery? javascript 触发事件
[解决办法]


<!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>无标题文档</title>
<script type="text/javascript">
function show(){
alert('f');
}
function showtime(e){
alert('f_');
e.stopPropagation();
}
</script>
</head>

<body>
<li onclick="show()"><a onclick="showtime(event)">确定</a><li>
</body>
</html><!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>无标题文档</title>
<script type="text/javascript">
function show(){
alert('f');
}
function showtime(e){
alert('f_');
e.stopPropagation();
}
</script>
</head>

<body>
<li onclick="show()"><a onclick="showtime(event)">确定</a><li>
</body>
</html>

热点排行