下面是人民网教育频道首页的flash图片幻灯,很酷的效果,但是就是在opera和chrome、火狐等支持W3C标准的浏览器下无法显示。我对JavaScript和W3C所知甚浅,虽然一直找相关的资料来看,还是弄不好这段代码。希望有高手看到了能够指点一下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> < title >flash幻灯</ title > </ head > < body > < script language = "JavaScript" type = "text/javascript" > // <![CDATA[ var imagePath=new Array();//图片地址 var linkPath=new Array();//连接地址 var infoText=new Array();//介绍性文字 linkPath.push("http://edu.people.com.cn/GB/gaokao/") infoText.push("北京考生报志愿胜经") linkPath.push("http://edu.people.com.cn/GB/gaokao/") infoText.push("全国各地高三年级模拟题大汇总") linkPath.push("http://edu.people.com.cn/GB/gaokao/") infoText.push("2009中国大学各学科100强") linkPath.push("http://edu.people.com.cn/GB/gaokao/") infoText.push("教育部考试中心主任戴家干就09高考答问") linkPath.push("http://edu.people.com.cn/GB/gaokao/") infoText.push("2009年高考志愿填报互动答疑") var imagePath_str="" var linkPath_str="" var infoText_str="" for(var i=0;i < 5;i++ ){ imagePath_str += imagePath<span style="text-decoration: line-through;">+"|"; linkPath_str += linkPath<span style="text-decoration: line-through;">+"|"; infoText_str += infoText<span style="text-decoration: line-through;">+"|"; } document.writeln("<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="300" height="275" id="flash2" align="middle">"); document.writeln("<param name="allowScriptAccess" value="sameDomain" />"); document.writeln("<param name="movie" value="http://edu.people.com.cn/css/2007jiaoyu/flash2.swf" />"); document.writeln("<param name="quality" value="high" />"); document.writeln("<param name="bgcolor" value="#ffffff" />"); document.writeln("<param name="FlashVars" value="ppurl="+imagePath_str+"&pplink="+linkPath_str+"&ppfinfo="+infoText_str+"" />"); document.writeln("<embed src="http://edu.people.com.cn/css/2007jiaoyu/flash2.swf" quality="high" bgcolor="#ffffff" width="300" height="275" name="flash2" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />"); document.writeln("</object>"); //]]> </ script > </ body > </ html > |
捣鼓了大半天,突然发现博客首页的幻灯插件和这个幻灯显示的方式是一样的,参照修改了一下就可以兼容chrome、opera和火狐等浏览器了!
修改后代码如下:
[/html]