function tdB.onclick()
{
if(event.srcElement.tagName != "TD") return false;
;//下面放你的程序
}
{
if(event.srcElement.tagName != "TD") return false;
;//下面放你的程序
}
解决方案 »
- 求助:使用ajax方式获取新页面内容替换当前整个页面,并执行新页面脚本
- 【求助】QueryString的一个问题和Ajax的onreadystatechange的一个问题
- Javascript 中radiobuttonlist赋值问题
- SOS javascript问题
- 怎样检测浏览器是否支持ActiveX 控件?
- 求正则:如果字符串的前11位没有:就在字符串前添加http://
- 请问有没有办法使鼠标和键盘都对该页面任何操作无响应
- 怎样用ScriptX设置IE横向打印?
- 各位大哥,请问
- 怎么用java script判断是用户输入的字符串内容是正确的日期格式(急)
- 如何把一个多选框中的项目移到另一个多选框?
- <<请不要做浮躁的人!>>中的文章对活跃在js论坛的同胞值得借鉴
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<script language="JavaScript">
function click_tdB()
{
if(event.srcElement != tdB) return false;
alert("点击了tdB!");
}function click_tbl2()
{
alert("点击了tbl2中的某处!")
}
</script>
</HEAD><BODY>
<TABLE id="tbl1" border=1 width=600>
<TR>
<TD>这个表格是tbl1</TD>
<TD id="tdB" onclick="click_tdB();">(tdB)点击这里<br>
<TABLE id="tbl2" border=1 width="100%" onclick="click_tbl2();">
<TR>
<TD>这个表格是tbl2</TD>
<TD>点击这个表格</TD>
<TD> </TD>
</TR>
<TR>
<TD> </TD>
<TD> </TD>
<TD> </TD>
</TR>
</TABLE>
</TD>
<TD> </TD>
<TD> </TD>
</TR>
</TABLE>
</BODY>
</HTML>
object.cancelBubble[ = cancelBubble]
SettingsThis read-write property takes a Boolean value: TRUE Cancels bubbling for this event, preventing the next event handler in the hierarchy from receiving the event.
FALSE Enables bubbling. This is the default value.
Using this property to cancel bubbling for an event does not affect subsequent events. ExampleThe following document fragment cancels bubbling of the onclick event if it occurs in the IMG element when the SHIFT key is down. This prevents the event from bubbling up to the onclick event handler for the document. <SCRIPT LANGUAGE="JScript">
function checkCancel() {
if (window.event.shiftKey)
window.event.cancelBubble = true;
}
function showSrc() {
if (window.event.srcElement.tagName == "IMG")
alert(window.event.srcElement.src);
}
</SCRIPT>
<BODY onclick="showSrc()">
<IMG onclick="checkCancel()" SRC="sample.gif">
在了解你的程序,为什么会运行子表中的事件?其实我在解决的是,我用一个js文件把网页上的格表,加上ID 加上事件,进行处理,这时处理子表就没有同样的效果.呵.修改中,
万分感谢!
http://expert.csdn.net/Expert/TopicView1.asp?id=2582796