javascript拖曳DIV时出现的问题,向大家请教 document.getElementById("fShowPage").window.document.onmousedown = function(e){alert(e);} 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 IE下用 windowFF下用 contentWindow <div><iframe id="ifInDiv" src="2.htm"></iframe></div><script>window.onload=function(){ if(document.all)document.frames['ifInDiv'].document.onmousedown=function(){ MouseDown(document.frames['ifInDiv'].event);//注意获取的是iframe中的事件对象,直接event会是null } else document.getElementById("ifInDiv").contentWindow.document.onmousedown=function(e){ MouseDown(e); }}function MouseDown(e){ alert(e);}</script> <html><script>function $(id){ return( document.getElementById(id));}function a(event){ alert( 1 );}window.onload = function(){ var f = $("iframe1").contentWindow || $("iframe1").window; f.document.onclick=a;}</script><body> <iframe id="iframe1" src="2-2.html"></iframe></body></html> 楼上几位兄弟的代码在src定死的时候是可以的,可是如果iframe.src是由js设置的话,代码就不执行了.这种情况大家有没有遇到? HOHO,这个问题我前两天回答过。是由于页面装载未完成的原因。你看看那个帖子吧。http://topic.csdn.net/u/20081102/16/f83ea1b7-5f7f-40e6-947f-63d4fcd5af1a.html 还是昨天的那个问题。。。。 关于javascript实现拖动层移动的问题 Chrome js 设为主页 请问如何实现图片和文字同时变换的效果! 谁能帮忙看一下!~高手请进!~ 全选Check box的问题~~~~~急急急 js正则表达式提取字串 求助:在IFrame中如何实现文本的自动换行??? 简单问题, /[\W]/g 和 /[^\d]/g 怎么解释? vue里根据路径打印图片,图片在浏览器里可以显示,点了打印以后在打印预览里就读取不到了 submit后, 在服务器处理完毕前, 怎末限制用户执行任何操作? 关于javascript做伸缩菜单,却无法实现伸缩效果。
FF下用 contentWindow
<script>
window.onload=function(){
if(document.all)document.frames['ifInDiv'].document.onmousedown=function(){
MouseDown(document.frames['ifInDiv'].event);//注意获取的是iframe中的事件对象,直接event会是null
}
else document.getElementById("ifInDiv").contentWindow.document.onmousedown=function(e){
MouseDown(e);
}
}function MouseDown(e)
{
alert(e);
}
</script>
<script>
function $(id){
return( document.getElementById(id));
}
function a(event){
alert( 1 );
}
window.onload = function(){
var f = $("iframe1").contentWindow || $("iframe1").window;
f.document.onclick=a;
}
</script>
<body>
<iframe id="iframe1" src="2-2.html"></iframe>
</body>
</html>
是由于页面装载未完成的原因。
你看看那个帖子吧。http://topic.csdn.net/u/20081102/16/f83ea1b7-5f7f-40e6-947f-63d4fcd5af1a.html