如何解决Javascript设置object标签的样式,导致swf文件重新加载的问题? 本帖最后由 bestzrz 于 2012-05-18 09:59:32 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!DOCTYPE HTML><html> <head> <meta charset="gb2312" /> <title></title> <style> </style> </head> <body> <embed id="test" src="flash921.swf" style="border:1px solid red; position:relative;"></embed> <button id="t">123</button> <script> function $(el){ return typeof el == 'string' ? document.getElementById(el) : el; } $('t').onclick = function(){ $('test').style.width = '323px'; $('test').style.top = '323px'; } </script> </body></html>测试了,没重新加载啊 <!DOCTYPE HTML><html> <head> <meta charset="gb2312" /> <title></title> <style> </style> </head> <body> <embed id="test" src="flash921.swf" style="border:1px solid red; position:relative;"></embed> <button id="t">123</button> <script> function $(el){ return typeof el == 'string' ? document.getElementById(el) : el; } $('t').onclick = function(){ $('test').style.width = '323px'; $('test').style.top = '323px'; $('test').style.position = 'absolute'; } </script> </body></html>修改成绝对定位就会 在ff下 确实重新加载了,ie 6、7、8 chrome 下没重新加载试着 改变其 父容器的css也不行<!DOCTYPE HTML><html> <head> <meta charset="gb2312" /> <title></title> <style> </style> </head> <body> <div id="test"> <embed id="test" src="flash921.swf" style="border:1px solid red;"></embed> </div> <button id="t">123</button> <script> function $(el){ return typeof el == 'string' ? document.getElementById(el) : el; } $('t').onclick = function(){ $('test').style.width = '323px'; $('test').style.top = '223px'; $('test').style.position = 'absolute'; } </script> </body></html>也有人发现过这个 问题http://blog.csdn.net/helloint/article/details/6438966再看看。 我又试了下,如果position默认absolute,Javascript中不修改position就没问题,但这不是我想要的,我想要在原始状态下object不包含任何样式。放大播放器就设置style,缩小播放器就清除style。还有,我是在chrome测试的,版本18.0 keyCode的问题 谁帮我解一下这个页面中的部分加密代码呢? firefox中onload为什么没用? 这段代码在FF下失效!! 一个JS树 求复杂的正则表达式写法。用于注册用户时真实姓名一项的判断!! jquery validate.js 比较大小 网页文件中的路径是指向哪里? 请问下 我做了弹窗 里面调用iframe 百度地图 为什么地图不显示呢 百思不得其解,IE浏览器不发送cookie,其它浏览器都没问题! js做后台 网页一打开时或关闭时就提示设置主页的javasrcipt为什么执行没有效果?
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<embed id="test" src="flash921.swf" style="border:1px solid red; position:relative;"></embed>
<button id="t">123</button>
<script>
function $(el){
return typeof el == 'string' ? document.getElementById(el) : el;
}
$('t').onclick = function(){
$('test').style.width = '323px';
$('test').style.top = '323px';
}
</script>
</body>
</html>
测试了,没重新加载啊
<!DOCTYPE HTML>
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<embed id="test" src="flash921.swf" style="border:1px solid red; position:relative;"></embed>
<button id="t">123</button>
<script>
function $(el){
return typeof el == 'string' ? document.getElementById(el) : el;
}
$('t').onclick = function(){
$('test').style.width = '323px';
$('test').style.top = '323px';
$('test').style.position = 'absolute';
}
</script>
</body>
</html>
修改成绝对定位就会
<html>
<head>
<meta charset="gb2312" />
<title></title>
<style>
</style>
</head>
<body>
<div id="test">
<embed id="test" src="flash921.swf" style="border:1px solid red;"></embed>
</div>
<button id="t">123</button>
<script>
function $(el){
return typeof el == 'string' ? document.getElementById(el) : el;
}
$('t').onclick = function(){
$('test').style.width = '323px';
$('test').style.top = '223px';
$('test').style.position = 'absolute';
}
</script>
</body>
</html>
也有人发现过这个 问题
http://blog.csdn.net/helloint/article/details/6438966
再看看。