有哪位高手告诉我一下,怎么让火狐浏览器兼容js?
例如这段代码为什么在ie中起作用,而在火狐中没有反映?
<SCRIPT type=text/javascript>
var pic_width=700; //图片宽度
var pic_height=225; //图片高度
var button_pos=2; //按扭位置 1左 2右 3上 4下
var stop_time=5000; //图片停留时间(1000为1秒钟)
var show_text=0; //是否显示文字标签 1显示 0不显示
var txtcolor="000000"; //文字色
var bgcolor="DDDDDD"; //背景色
var imag=new Array();
var link=new Array();
var text=new Array();imag[1]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_12741864081XQP.jpg";
link[1]="";
text[1]="";imag[2]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_1274186485uxAy.jpg";
link[2]="";
text[2]="";imag[3]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_1274186487Yey2.jpg";
link[3]="";
text[3]="";imag[4]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_1274186487VeCh.jpg";
link[4]="";
text[4]="";imag[5]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_1274186489lu66.jpg";
link[5]="";
text[5]="";//可编辑内容结束var swf_height=show_text==1?pic_height+20:pic_height;
var pics="", links="", texts="";
for(var i=1; i<imag.length; i++){
pics=pics+("|"+imag[i]);
links=links+("|"+link[i]);
texts=texts+("|"+text[i]);
}
pics=pics.substring(1);
links=links.substring(1);
texts=texts.substring(1);document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cabversion=6,0,0,0" width="'+ pic_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="focus.swf">');
document.write('<param name="quality" value="high"><param name="wmode" value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'">');
document.write('<embed src="images/top/flash/focus.swf" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" quality="high" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
</SCRIPT>
例如这段代码为什么在ie中起作用,而在火狐中没有反映?
<SCRIPT type=text/javascript>
var pic_width=700; //图片宽度
var pic_height=225; //图片高度
var button_pos=2; //按扭位置 1左 2右 3上 4下
var stop_time=5000; //图片停留时间(1000为1秒钟)
var show_text=0; //是否显示文字标签 1显示 0不显示
var txtcolor="000000"; //文字色
var bgcolor="DDDDDD"; //背景色
var imag=new Array();
var link=new Array();
var text=new Array();imag[1]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_12741864081XQP.jpg";
link[1]="";
text[1]="";imag[2]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_1274186485uxAy.jpg";
link[2]="";
text[2]="";imag[3]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_1274186487Yey2.jpg";
link[3]="";
text[3]="";imag[4]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_1274186487VeCh.jpg";
link[4]="";
text[4]="";imag[5]="http://image.pojaa.com/lj/h/attachment/201005/18/8147884_1274186489lu66.jpg";
link[5]="";
text[5]="";//可编辑内容结束var swf_height=show_text==1?pic_height+20:pic_height;
var pics="", links="", texts="";
for(var i=1; i<imag.length; i++){
pics=pics+("|"+imag[i]);
links=links+("|"+link[i]);
texts=texts+("|"+text[i]);
}
pics=pics.substring(1);
links=links.substring(1);
texts=texts.substring(1);document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cabversion=6,0,0,0" width="'+ pic_width +'" height="'+ swf_height +'">');
document.write('<param name="movie" value="focus.swf">');
document.write('<param name="quality" value="high"><param name="wmode" value="opaque">');
document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'">');
document.write('<embed src="images/top/flash/focus.swf" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" quality="high" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
</SCRIPT>
解决方案 »
- dhtmlchart 横轴文字怎么改变样式
- jsp 导出excel问题
- 大家开发图表的时候一般用什么图表组件啊 都来谈谈 有效果图的最好
- Too many open files 报错信息
- 如何避免Processing of multipart/form-data request failed. Read timed out
- 我建立了一个群,主要用于探讨HTML,DHTML,CSS,JAVASCRIPT,FLASH,DREAMWEAVER,PHOTOSHOP技术,希望从事这方面工作的同志加入
- 急,请教,弱智问题:基本的servlet程序里的HttpServletRequest , HttpServletResponse 竟然可以实例化?
- 100分!新浪auth2.0sdk包放在基于百度云的web上就不可用了
- 自己第一次编写tag lib遇上的问题
- Servlet JDBC错 误
- 请教个Struts2 XML效验问题
- 请教一个弹出窗口的问题
自己也不是很懂js,写的时候就用firebug看,也能设置断点,执行。
document.write('<embed src="images/top/flash/focus.swf" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&pic_width='+pic_width+'&pic_height='+pic_height+'&show_text='+show_text+'&txtcolor='+txtcolor+'&bgcolor='+bgcolor+'&button_pos='+button_pos+'&stop_time='+stop_time+'" quality="high" width="'+ pic_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
ff识别的是embed标签,你改改这里。
document.write('<param name="movie" value="http://www.xcwljy.cn/images/slide.swf" />');
document.write('<param name="allowScriptAcess" value="sameDomain" />');
document.write('<param name="quality" value="best" />');
document.write('<param name="bgcolor" value="#E5ECF4" />');
document.write('<param name="scale" value="noScale" />');
document.write('<param name="menu" value="false">');
document.write('<param name="wmode" value="opaque" />');
document.write('<param name="FlashVars" value="playerMode=embedded&pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" />');
document.write('</object>');
其中的变量名字自己替换
.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'
+ focus_width + '" height="' + swf_height + '">');
document
.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/focus1.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
document
.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics=' + pics + '&links='
+ links + '&texts=' + texts + '&borderwidth=' + focus_width
+ '&borderheight=' + focus_height + '&textheight=' + text_height
+ '">');
document.write('<embed width="'+focus_width+'" height="'+swf_height+'" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" name="photo_player" quality="high" wmode="opaque" flashvars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" src="images/focus1.swf"></embed>');
document.write('</object>');
</script>
<script type="text/javascript">
imgUrl1="images/news/01.jpg";
imgtext1="反反复复1"
imgLink1=escape("News.action?nContent.news_id=1");
imgUrl2="images/news/02.jpg";
imgtext2="反反复复2"
imgLink2=escape("News.action?nContent.news_id=2");
imgUrl3="images/news/03.jpg";
imgtext3="反反复复3"
imgLink3=escape("News.action?nContent.news_id=3");
imgUrl4="images/news/04.jpg";
imgtext4="反反复复4"
imgLink4=escape("News.action?nContent.news_id=4");
imgUrl5="images/news/01.jpg";
imgtext5="反反复复5"
imgLink5=escape("News.action?nContent.news_id=6");
var focus_width = 230
var focus_height = 171
var text_height = 18
var swf_height = focus_height + text_height var pics = imgUrl1 + "|" + imgUrl2 + "|" + imgUrl3 + "|" + imgUrl4 + "|"
+ imgUrl5
var links = imgLink1 + "|" + imgLink2 + "|" + imgLink3 + "|" + imgLink4
+ "|" + imgLink5
var texts = imgtext1 + "|" + imgtext2 + "|" + imgtext3 + "|" + imgtext4
+ "|" + imgtext5 document
.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'
+ focus_width + '" height="' + swf_height + '">');
document
.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="images/focus1.swf"><param name="quality" value="high"><param name="bgcolor" value="#F0F0F0">');
document
.write('<param name="menu" value="false"><param name=wmode value="opaque">');
document.write('<param name="FlashVars" value="pics=' + pics + '&links='
+ links + '&texts=' + texts + '&borderwidth=' + focus_width
+ '&borderheight=' + focus_height + '&textheight=' + text_height
+ '">');
document.write('<embed width="'+focus_width+'" height="'+swf_height+'" align="middle" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowscriptaccess="always" name="photo_player" quality="high" wmode="opaque" flashvars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" src="images/focus1.swf"></embed>');
document.write('</object>');
</script>
这可是在ff浏览器下打开复制的源代码,你把最上面的5个图链接及显示信息改掉,下面的focus1.swf改掉,
在试试吧。不行我也无语了