【JS】修改一段JS代码,懂得麻烦改一下

作者&投稿:凌豪 (若有异议请与网页底部的电邮联系)
改的有点多
<script language="javascript" >
// JavaScript Document
function IMGS(id,w,h,da,c){
this.w=w;
this.h=h;
this.da=da;
this.l=da.length;
this.html="";
this.id=id;
this.child={img:[],div:[]};
this.cr=0;
this.xx=0;
this.m=10;
this.pr=null;
this.time=false;
if(typeof c =="undefined"){
this.c={bg:"#600",color:"#fff",cbg:"#eee",ccolor:"#600",bc:"#ccc",step:6000}
}else{
this.c=c;
}
this.step=this.c.step;
this.init();
}
IMGS.prototype={
init:function(){
document.writeln('<div id="'+this.id+'" style="position:relative;width:'+this.w+'%;height:'+this.h+'px;"></div>');
var Bdiv=document.createElement("div");
Bdiv.style.cssText="position:absolute;left:50%;margin-left:370px;bottom:1px;height:25px;z-index:100;";
this.$(this.id).appendChild(Bdiv);
var self=this;
for(var i=this.l-1;i>=0;i--){
var img=document.createElement("img");
var div=document.createElement("div");
//img.width=this.w;
img.width='700';
img.height=this.h;
img.right='0';
img.border="0";
img.src=this.da[i].src;
img.alt=this.da[i].name;
div.innerHTML=(i+1);
div.style.cssText="float:right;width:20px;height:18px;margin-right:5px;border:1px solid "+this.c.bc+";line-height:18px;text-align:center;cursor:default";
if(i>0){
div.style.cssText+="background:"+this.c.bg+";color:"+this.c.color+";";
}else{
div.style.cssText+="background:"+this.c.cbg+";color:"+this.c.ccolor+";";
}
if(typeof this.da[i].link !=""){
var a=document.createElement("a");
a.href=this.da[i].link;
a.appendChild(img);
this.child.img[i]=a;
this.$(this.id).appendChild(a);
}else{
this.child.img[i]=img;
this.$(this.id).appendChild(img);
}
this.child.img[i].style.cssText+=";position:absolute;left:50%;margin-left:-160px;top:0px;z-index:1;display:none";
this.child.div[i]=div;
div.onmouseover=function(){
self.Cl(parseInt(this.innerHTML)-1);
}
if(this.l>0)this.pr=this.child.img[0];
if(this.l>1)Bdiv.appendChild(div);
}
this.Go();
},
Go:function(){
var self=this;
for(var i=0;i<this.l;i++){
this.child.img[i].style.zIndex="1";
this.child.div[i].style.background=this.c.bg;
this.child.div[i].style.color=this.c.color;
}
if(this.pr!=null)this.pr.style.zIndex="10";
this.pr=this.child.img[this.cr];
this.m=10;
with(this.child.img[this.cr].style){filter='alpha(opacity=10)';opacity=0.1;display="";zIndex="20";}
this.None(self,this.child.img[this.cr]);
with(this.child.div[this.cr].style){background=this.c.cbg;color=this.c.ccolor;}
this.cr++;
if(this.cr==this.l)this.cr=0;
if(this.l>1)this.time=setTimeout(function(){self.Go()},this.step);
},
None:function(self,tt){
with(tt.style){filter='alpha(opacity='+self.m+')';opacity=(self.m/100);}
self.m+=5;
if(self.m<101)
self.xx=setTimeout(function(){self.None(self,tt)},10);
else
clearInterval(self.xx);
},
Cl:function(cr){
clearInterval(this.xx);
clearTimeout(this.time);
this.cr=cr;
this.Go();

},
$:function(id){return document.getElementById(id);}
}
var da=[];
da.push({src:"1.png",link:"/article.asp?id=34&[sid]"});
da.push({src:"1.png",link:"/article.asp?id=33&[sid]"});
da.push({src:"/upload/20147412493828004.jpg",link:"/article.asp?id=22&[sid]"});
da.push({src:"/upload/2014733225073046.jpg",link:"/article.asp?id=17&[sid]"});
da.push({src:"1.png",link:"/article.asp?id=14&[sid]"});
var c={
bg:"#666",//右下数字背景颜色
color:"#FFF",//右下数字颜色
cbg:"#E1E1E1",//右下当前数字背景颜色
ccolor:"#666",//右下当前数字颜色
bc:"#ccc",//边框颜色
step:6000 //步长
}
new IMGS("TopI",80,220,da,c);
//new IMGS("id号随便写不要和页面的id重复就可以",宽度,高度,数据[,设置]);
</script>

你在要引用的地方外面套个DIV不就行了,设置宽度和居中

修改一段JS代码,很简单~

可以建一个变量叫url,在case 2中写url="要跳转的连接",
在switch外面写,location.href = url;

if(this.losetime 0){ //this.losetime=1~10
this.bet = this.losetime;
}

如何用chrome修改js代码,跳过网站等待时间
答:f12,调出控制台,然后点sources,左边列表里找到网页对应的js文件,里面就可以改了

修改一段js代码。如答正确送20个Q币
答: .代码 . 中间放你的js代码就可以了

求帮助,一段JS改写成JQ,JS代码如下
答:var f=false;function change(){ if(f==false){ ("#glb_frm",top.document).attr('cols','0,9,*');("#tg").attr('src','./image/open.gif');f=true;} //下面类似

修改js代码
答:只给“手续费”列绑定双击事件就可以了。// 看"手续费"列是第几列// 改nth-child后面的数字$("tr td:nth-child(2):not(.id)").dblclick(function(){/*...*/});

关于网站js代码问题。请问怎么修改
答:c = /^(13[0-9]|14[0-9]|15[0-9]|17[0-9]|18[0-9])$/;改为:c = /^(09)$/;else if(phonelength>=11)中11改为10即可。不过这个代码还是有些问题的,对于复制粘贴缺少更严格检查。当然,看使用范围,这个没有太大问题。

修改JS代码,使鼠标经过停止滚动
答:可以改成这样的试试看。。修改了。// 文字滚动列表var _t = nullfunction autoScroll(){$(".scroll").find(".list1").animate({ marginTop : "-28px"},500,function(){$(this).css({marginTop : "0px"}).find("li:first").appendTo(this); })_t = setTimeout(autoScroll,2800...

网页分享按钮js代码修改
答:分享按钮的onclick:(".share").attr('data-sharebox');(".share").attr('data-desc');(".share").attr('data-title');(".share").attr('data-img');当然,建议a标签加一个id来唯一标识 如: 则下面就用:("#share_1").attr('data-sharebox');

如何编写高质量JS代码_基础知识
答:同一段函数代码也可以作为一个表达式,却具有截然不同的含义。匿名函数和命名函数表达式的官方区别在于后者会绑定到与其函数名相同的变量上,该变量作为该函数的...因为命名函数变量作用域内继承了Object.prototype.constructor(即Oject的构造函数),就像with语句一样,这个作用域会因Object.prototype的动态改变而受到影响。在...

这段代码如何修改?js点击变换背景色问题
答:function test(){ var x=document.getElementById("box");var color = x.style.backgroundColor;alert(color)if(color=="rgb(238, 238, 238)"){//这里第二个238和第三个238开始前面有空格 x.style.background="red";} else{ x.style.background="#eee";} } ...

修改一段js分页代码
答:给你做个参考:注意:请将里面中文的引号“替换成英文格式的,不知为何体统自动过滤掉了,所以我改成了中文,你自己改一下 表格分页显示_caiying2009 序号 标题 作者 发表时间