怎么样用Javascript这样控制鼠标,请大哥帮忙,急啊! <img src='..' onclick='alert(1);this.onclick=false'>; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 IE:<img src="http://www.csdn.net/ui/styles/public_header_footer/logo_csdn.gif" onclick="alert('img');" disabled="disabled">可以通过设置IMG的disabled属性来达到效果;其他浏览器需要改变该对象的onclick事件:<img src="http://www.csdn.net/ui/styles/public_header_footer/logo_csdn.gif" onclick="alert('img');this.onclick=null"> 如果这个画面上有很多控件,我的意思是整个document上不能点 disabled这个方案我试过了,问题是真个画面不能postback了,是否可以做到不能点,但是这个画面的其他功能还要保留。 根据你的描述,似乎需要使用页面掩码页的技术来实现掩码页:在当前页面上覆盖一个透明或者半透明的iframe,让其覆盖页面的其他部分,使其失效演示页面a.html-------------------------------------------------------------------------------<html><script language=javascript>function demo(){ showPageMask(); test();}var g_for_test = null;function test(){ g_for_test = document.createElement("<div style=width:100;height:100;position:absolute;left:200;top:200;background-color:yellow></div>"); g_for_test.innerHTML = "看看还能点击button不?<input type=button value=点我恢复 onclick=haha()>"; document.body.appendChild(g_for_test);}function haha(){ document.body.removeChild(g_for_test); document.body.removeChild(g_page_mask);}var g_page_mask = null;function showPageMask(){g_page_mask = document.createElement("<div style=\"position:absolute;top:0;left:0;width:"+document.body.clientWidth+";height:"+document.body.clientHeight+"\"></div>");document.body.appendChild(g_page_mask);g_page_mask.innerHTML = "<iframe style=\"FILTER:Alpha(opacity=20);width:100%;height:100%\" onclick=alert()></iframe>";}function hidePageMask(){ if( g_page_mask != null ) document.body.removeChild(g_page_mask);}</script><body><input type=button value="click me" onclick=demo()><br><input type=button value="click me" onclick=demo()><br></body></html>------------------------------------------------------------------------------- 这是个好办法,但是有个问题哦,image,DropDownList控件遮不住 是z-index的问题,如果你是用asp.net开发平台拖动的控件的话,他们有z-index,而DropDownList在客户端转换成了select,你需要进行如下变更!!!注意div的style里面多了一个z-index:999;保证掩码页div的zindex最大就可以了--------------------------------------------------function showPageMask(){g_page_mask = document.createElement("<div style=\"z-index:999;position:absolute;top:0;left:0;width:"+document.body.clientWidth+";height:"+document.body.clientHeight+"\"></div>");document.body.appendChild(g_page_mask);g_page_mask.innerHTML = "<iframe style=\"FILTER:Alpha(opacity=20);width:100%;height:100%\" onclick=alert()></iframe>";} 接上,同时还要保证!!!!注意这个测试用的弹出层,保证zindex高于掩码页的zindexfunction test(){ g_for_test = document.createElement("<div style=z-index:1000;width:100;height:100;position:absolute;left:200;top:200;background-color:yellow></div>"); g_for_test.innerHTML = "看看还能点击button不?<input type=button value=点我恢复 onclick=haha()>"; document.body.appendChild(g_for_test);} Select的z-Index好像很高喔,設多少都不行 jquery 控制freetextbox控件的长度 jquery这个能省吗 IE6触发onmouseover事件IE停止响应 js 改变td 背景颜色 当鼠标移走时如何恢复 DIV中的TEXT里光标丢失的问题 java.lang.NoClassDefFoundError: JspException 求大神帮忙 框架内用JavaScript传值 函数名给忘了 JavaScript 中有和C中的sprintf,vsprintf一样功能的函数吗? 调用jquery的remove问题 javascript得到来源页解析问题 没有多少分了,只求三个正则表达式,谢谢了
<img src="http://www.csdn.net/ui/styles/public_header_footer/logo_csdn.gif" onclick="alert('img');" disabled="disabled">
可以通过设置IMG的disabled属性来达到效果;其他浏览器需要改变该对象的onclick事件:
<img src="http://www.csdn.net/ui/styles/public_header_footer/logo_csdn.gif" onclick="alert('img');this.onclick=null">
掩码页:在当前页面上覆盖一个透明或者半透明的iframe,让其覆盖页面的其他部分,使其失效
演示页面
a.html
-------------------------------------------------------------------------------
<html>
<script language=javascript>
function demo()
{
showPageMask();
test();
}var g_for_test = null;
function test()
{
g_for_test = document.createElement("<div style=width:100;height:100;position:absolute;left:200;top:200;background-color:yellow></div>");
g_for_test.innerHTML = "看看还能点击button不?<input type=button value=点我恢复 onclick=haha()>";
document.body.appendChild(g_for_test);
}
function haha()
{
document.body.removeChild(g_for_test);
document.body.removeChild(g_page_mask);
}
var g_page_mask = null;
function showPageMask()
{
g_page_mask = document.createElement("<div style=\"position:absolute;top:0;left:0;width:"+document.body.clientWidth+";height:"+document.body.clientHeight+"\"></div>");
document.body.appendChild(g_page_mask);
g_page_mask.innerHTML = "<iframe style=\"FILTER:Alpha(opacity=20);width:100%;height:100%\" onclick=alert()></iframe>";
}function hidePageMask()
{
if( g_page_mask != null )
document.body.removeChild(g_page_mask);
}
</script>
<body>
<input type=button value="click me" onclick=demo()><br>
<input type=button value="click me" onclick=demo()><br>
</body>
</html>-------------------------------------------------------------------------------
--------------------------------------------------
function showPageMask()
{
g_page_mask = document.createElement("<div style=\"z-index:999;position:absolute;top:0;left:0;width:"+document.body.clientWidth+";height:"+document.body.clientHeight+"\"></div>");
document.body.appendChild(g_page_mask);
g_page_mask.innerHTML = "<iframe style=\"FILTER:Alpha(opacity=20);width:100%;height:100%\" onclick=alert()></iframe>";
}
!!!!注意这个测试用的弹出层,保证zindex高于掩码页的zindex
function test()
{
g_for_test = document.createElement("<div style=z-index:1000;width:100;height:100;position:absolute;left:200;top:200;background-color:yellow></div>");
g_for_test.innerHTML = "看看还能点击button不?<input type=button value=点我恢复 onclick=haha()>";
document.body.appendChild(g_for_test);
}