• 全部
  • C#综合技术
  • C#互联网桌面应用
  • AppLauncher
  • WinForm&WPF
  • C#开发新技术
  • 问答

是高手请进,帮助修改一段javascript,希望得到你的帮助

hejiwang 2009-04-17 10:12:41
第一个文件:flash.html
<table align=center style="border:1px solid #7CC0FF;margin-top:5px" cellspacing=0 cellpadding=0 width="100%">
<tr>
<td>
<div align=center> <script language="JavaScript">ssrc="http://www.spiderexcel.com/e9a8a381143e4ce09cc72e88e7b8c0ee.swf";width="640";height="465"; </script> <script language=javascript src="swfshow.js"> </script> </div> </td>
</tr>
</table>
第二个文件js文件:swfshow.js
ad_src = "http://i3.sinaimg.cn/gm/iframe/casual/littlegame/guangg/U1850P115T18D6379F1274DT20090306193008.JPG"; //广告图片地址,jpg或gif格式,640x480
ad_url = "http://sina.allyes.com/main/adfclick?db=sina&bid=150197,189093,194072&cid=0,0,0&sid=181808&advid=1832&camid=26012&show=ignore&url=http://adsresult.joywell.com.cn/count/stat_click.aspx?RD=8120&CD=84&AD=8106&MD=71&LD=491&AL=http://ys.10sea.com/index.shtml?adcode=00000000450000000177"; //广告监测和链接
//广告配置 结束

urlcnc=ssrc;

if(ssrc.indexOf("ttp://")>0){
ssrc0=ssrc;
ssrc1=ssrc;
ssrc2=ssrc;
ssrc3=ssrc;
ssrc4=ssrc;
}else{
ssrc0=""+ssrc;
ssrc1=""+ssrc;
ssrc2=""+ssrc;
ssrc3=""+ssrc;
ssrc4=""+ssrc;
}

rnd.today=new Date();
rnd.seed=rnd.today.getTime();
function rnd() {
rnd.seed = (rnd.seed*9301+49297) % 233280;
return rnd.seed/(233280.0);
};

function rand(number) {
return Math.ceil(rnd()*number);
}

var rand_num=rand(4);
ssrc=eval("ssrc"+(rand_num-1))

if (ssrc.indexOf(".dcr") != -1 || ssrc.indexOf(".dir")!=-1){
if(ssrc.indexOf(".dcr")!=-1){
document.write(" <object classid='clsid:166B1BCA-3F9C-11CF-8075-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,0,0,0' width='"+width+"' name=gameyesflash id=gameyesflash height='"+height+"' style='border:0 solid #CEBE90'>\
<param name='src' value='"+ssrc+"'>\
<param name=swStretchStyle value=fill>\
<embed src='"+ssrc+"' width='"+width+"' height='"+height+"' pluginspage='http://www.macromedia.com/shockwave/download/' name=gameyesflash id=gameyesflash>\
</embed> </object>")
}else{
document.write(" <EMBED src='"+ssrc+"' width='566' name=gameyesflash id=gameyesflash height='450' style='border:0 solid #CEBE90' type=application/x-shockwave-flash>")
}
/* */
document.write(' <span id="ads"> </span>')
}

if (ssrc.indexOf(".swf") != -1){
if(typeof(ad_src)!='undefined' && ad_src!=''){ //有广告
document.write('\
<div style="width:'+width+'px;position:relative;text-align:left;">\
<div style="position:absolute;" id="loading_div" style="width:'+width+'px;">\
<div> <a href="'+ad_url+'" target="_blank"> <img src="'+ad_src+'" border="0"> </a> </div>\
<div style="height:10px;border:1px solid #000000;text-align:left;"> <div style="height:10px;width:0;background:url(http://i3.sinaimg.cn/gm/hd/ks/swf.gif);float:left;" id="perbar_div"> </div> </div>\
<div align="center" style="clear:both;"> <font color="#034470">游戏正在加载 <span id="percent_div"> </span>,请稍候。。。 </font> </div>\
</div>\
<div id="game_div" style="visibility:hidden;margin:0 0 30px 0;">\
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" align="middle" id="gameyesflash">\
<param name="allowScriptAccess" value="always" />\
<param name="wmode" value="window" />\
<param name="movie" value="'+ssrc+'" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="bgcolor" value="#990000" /> <embed src="'+ssrc+'" name="gameyesflash" menu="false" quality="high" bgcolor="#990000" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="always" wmode="window" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\
</object>\
</div>\
</div>\
');
var game_swf = getSwf('gameyesflash');
var game_div = document.getElementById('game_div');
var perbar_div = document.getElementById('perbar_div');
var percent_div = document.getElementById('percent_div');
var loading_div = document.getElementById('loading_div');
var loadingtime = 5; //至少显示5秒
var starttime = new Date();
var aditv = setInterval(percent, 50);
}else{ //无广告
document.write('\
<div id="game_div">\
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" align="middle" id="gameyesflash">\
<param name="allowScriptAccess" value="always" />\
<param name="wmode" value="transparent" />\
<param name="movie" value="'+ssrc+'" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <param name="bgcolor" value="#990000" /> <embed src="'+ssrc+'" name="gameyesflash" menu="false" quality="high" bgcolor="#990000" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\
</object>\
</div>\
');
}
}

function percent() {
try{
var per = game_swf.PercentLoaded();
}catch(e){
var per = 100;
}
var time = (new Date())-starttime;
var time_per = Math.round(time/10/loadingtime);
if(per>time_per) per = time_per;
perbar_div.style.width = width*per/100+'px';
percent_div.innerHTML = per+'%';
if (per>=100){
clearInterval(aditv);
loading_div.innerHTML = '';
loading_div.style.display = "none";
game_div.style.margin = 0;
game_div.style.visibility='visible';
}
}

function getSwf(id){
if(document.all){
return(document.getElementById(id));
}else{
return(document.embeds[id]);
}
}

上页代码是正常页,把js(粗体部分)修改一下就不能正常显示,谢谢大家
把:
<div> <a href="'+ad_url+'" target="_blank"> <img src="'+ad_src+'" border="0"> </a> </div>\
修改成:
<div> <script type="text/javascript">\
google_ad_client = "pub-6890015763382433";\
google_ad_width = 300;\
google_ad_height = 250;\
google_ad_format = "300x250_as";\
google_ad_type = "text_image";\
google_ad_channel = "0465360793";\
google_color_border = "ffffff";\
google_color_bg = "ffffff";\
google_color_link = "0000FF";\
google_color_text = "000000";\
google_color_url = "008000";\
</script>\
<script type="text/javascript"\
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">\
</script> </div>\

希望达到未修改前的效果,只是把以前的图片替换成google广告内容,谢谢大家
...全文
52 点赞 收藏 7
写回复
7 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
itcrazyman 2009-04-17
mark UP 帮顶
回复
boywangliang 2009-04-17
这么多
  帮顶
回复
aby913 2009-04-17
帮顶
回复
十八道胡同 2009-04-17
帮顶
回复
tsp860901 2009-04-17
眼睛都看花了。。
回复
麻子Mozart 2009-04-17
帮顶
回复
CeShenBeiWang 2009-04-17
up
回复
发帖
C#
创建于2007-09-28

10.5w+

社区成员

.NET技术 C#
申请成为版主
帖子事件
创建了帖子
2009-04-17 10:12
社区公告

让您成为最强悍的C#开发者