错误: 'imgInit' 未定义?在html页面中一切正常,换到asp.net中报错,说 'imgInit ' 未定义
<script>functiongo_Img(WNum,HNum,TNum){Go_Num=(imgUrl.length-1);key=0;adNum=0;theTime...
<script>
function go_Img(WNum,HNum,TNum){
Go_Num=(imgUrl.length-1);key=0;adNum=0;theTimer='';
var C_lass;
var $=function $(str){return document.write(str);};
var C_ss="<style>";
C_ss=C_ss+"div{overflow:hidden;}";
C_ss=C_ss+".W_Ord{overflow;hidden;text-align:center;color:#F00;font-weight:bold;clear:both;width:"+WNum+"px;height:"+TNum+";background-color:#eee;}";
C_ss=C_ss+".Min_On{color:#fff;Float:right;background-color:#f00;cursor:pointer;width:30px;height:20px;padding-top:1px;border:1px solid #f60;text-align:center;font-weight:bold;border-left:1px solid #eee;border-right:1px solid #eee;margin-left:-1px;}";
C_ss=C_ss+".Min_Off{color:#fff;Float:right;cursor:pointer;width:30px;height:20px;padding-top:1px;border-left:1px solid #eee;border-right:1px solid #eee;margin-left:-1px;text-align:center;font-weight:bold;}";
C_ss=C_ss+"</style>";
$(C_ss);C_ss='';
$("<Div style='width:"+WNum+"px;height:"+HNum+"px;border:1px solid #eee;'>");
$("<div style='width:"+WNum+"px;height:"+HNum+"px;'><img style='Cursor:Pointer;Filter:revealTrans(duration=2,transition=12);width:"+WNum+"px;height:"+HNum+"px;' src='"+imgUrl[1]+"' name=imgInit onclick=go_Url();></Div>");
$("<div class='Rig' style='width:"+WNum+"px;height:20px;margin-top:-20px;'>");
for (var i=100;i>0 ;i=i-2){
$("<Div style='float:right;width:4px;height:20px;background-color:#000;filter:alpha(opacity="+i/2+");-moz-opacity:0."+i/20+";opacity: 0."+i/20+"; '> </Div>");
}
$("</Div>");
$("<Div class='Rig' style='width:"+WNum+"px;height:"+HNum+"px;margin-top:-20px;'>");
for (var j=Go_Num;j>0 ;j--){
if (j==1){C_lass='Min_On';}else{C_lass='Min_Off';}
$("<Div Id='Min"+j+"' class='"+C_lass+"' onmouseover=nextAd("+j+");>"+j+"</Div>");
}
$("</Div>");
$("</Div>");
if (TNum && TNum!=''){
$("<Div Id='W_Ord' class='W_Ord'>"+imgWord[1]+"</Div>");
}
nextAd(1);
}
function nextAd(GetNum){
var O=function O(objid){return document.getElementById(objid);}
adNum=adNum%Go_Num;
adNum++ ;
if(GetNum!=undefined && GetNum!=0){adNum=GetNum;}
if(key==0){key=1;}
else if(document.all){
imgInit.filters.revealTrans.Transition=23;
imgInit.filters.revealTrans.apply();
imgInit.filters.revealTrans.play();
if (document.all.W_Ord!=undefined){document.all.W_Ord.innerHTML=imgWord[adNum];}
for (var i=1;i<(Go_Num+1);i++ ){O('Min'+i).className='Min_Off';}
O('Min'+adNum).className='Min_On';
}
document.images.imgInit.src=imgUrl[adNum];
if (GetNum==undefined){theTimer=setTimeout(nextAd, 6000);}
else{clearTimeout(theTimer);theTimer=setTimeout(nextAd, 6000);}
}
function go_Url(jumpTarget){
jumpUrl=imgLink[adNum];
jumpTarget='_blank'; //_blank
if (jumpUrl != ''){
if (jumpTarget != '')
window.open(jumpUrl,jumpTarget);
else
location.href=jumpUrl;
}
}
</script>
<script>
var imgUrl=new Array();
var imgLink=new Array();
var imgWord=new Array();
imgUrl[1]=' ';
imgLink[1]=' ';
imgWord[1]='';
imgUrl[2]=' ';
imgLink[2]=' ';
imgWord[2]='';
go_Img(290,205,20);
</script> 展开
function go_Img(WNum,HNum,TNum){
Go_Num=(imgUrl.length-1);key=0;adNum=0;theTimer='';
var C_lass;
var $=function $(str){return document.write(str);};
var C_ss="<style>";
C_ss=C_ss+"div{overflow:hidden;}";
C_ss=C_ss+".W_Ord{overflow;hidden;text-align:center;color:#F00;font-weight:bold;clear:both;width:"+WNum+"px;height:"+TNum+";background-color:#eee;}";
C_ss=C_ss+".Min_On{color:#fff;Float:right;background-color:#f00;cursor:pointer;width:30px;height:20px;padding-top:1px;border:1px solid #f60;text-align:center;font-weight:bold;border-left:1px solid #eee;border-right:1px solid #eee;margin-left:-1px;}";
C_ss=C_ss+".Min_Off{color:#fff;Float:right;cursor:pointer;width:30px;height:20px;padding-top:1px;border-left:1px solid #eee;border-right:1px solid #eee;margin-left:-1px;text-align:center;font-weight:bold;}";
C_ss=C_ss+"</style>";
$(C_ss);C_ss='';
$("<Div style='width:"+WNum+"px;height:"+HNum+"px;border:1px solid #eee;'>");
$("<div style='width:"+WNum+"px;height:"+HNum+"px;'><img style='Cursor:Pointer;Filter:revealTrans(duration=2,transition=12);width:"+WNum+"px;height:"+HNum+"px;' src='"+imgUrl[1]+"' name=imgInit onclick=go_Url();></Div>");
$("<div class='Rig' style='width:"+WNum+"px;height:20px;margin-top:-20px;'>");
for (var i=100;i>0 ;i=i-2){
$("<Div style='float:right;width:4px;height:20px;background-color:#000;filter:alpha(opacity="+i/2+");-moz-opacity:0."+i/20+";opacity: 0."+i/20+"; '> </Div>");
}
$("</Div>");
$("<Div class='Rig' style='width:"+WNum+"px;height:"+HNum+"px;margin-top:-20px;'>");
for (var j=Go_Num;j>0 ;j--){
if (j==1){C_lass='Min_On';}else{C_lass='Min_Off';}
$("<Div Id='Min"+j+"' class='"+C_lass+"' onmouseover=nextAd("+j+");>"+j+"</Div>");
}
$("</Div>");
$("</Div>");
if (TNum && TNum!=''){
$("<Div Id='W_Ord' class='W_Ord'>"+imgWord[1]+"</Div>");
}
nextAd(1);
}
function nextAd(GetNum){
var O=function O(objid){return document.getElementById(objid);}
adNum=adNum%Go_Num;
adNum++ ;
if(GetNum!=undefined && GetNum!=0){adNum=GetNum;}
if(key==0){key=1;}
else if(document.all){
imgInit.filters.revealTrans.Transition=23;
imgInit.filters.revealTrans.apply();
imgInit.filters.revealTrans.play();
if (document.all.W_Ord!=undefined){document.all.W_Ord.innerHTML=imgWord[adNum];}
for (var i=1;i<(Go_Num+1);i++ ){O('Min'+i).className='Min_Off';}
O('Min'+adNum).className='Min_On';
}
document.images.imgInit.src=imgUrl[adNum];
if (GetNum==undefined){theTimer=setTimeout(nextAd, 6000);}
else{clearTimeout(theTimer);theTimer=setTimeout(nextAd, 6000);}
}
function go_Url(jumpTarget){
jumpUrl=imgLink[adNum];
jumpTarget='_blank'; //_blank
if (jumpUrl != ''){
if (jumpTarget != '')
window.open(jumpUrl,jumpTarget);
else
location.href=jumpUrl;
}
}
</script>
<script>
var imgUrl=new Array();
var imgLink=new Array();
var imgWord=new Array();
imgUrl[1]=' ';
imgLink[1]=' ';
imgWord[1]='';
imgUrl[2]=' ';
imgLink[2]=' ';
imgWord[2]='';
go_Img(290,205,20);
</script> 展开
展开全部
Filter:revealTrans(duration=2,transition=12);width:"+WNum+"px;height:"+HNum+"px;' src='"+imgUrl[1]+"' name=imgInit onclick=go_Url();></Div>");
name=imgInit
属性尽量放进双引号中
直接用变量imgInit来访问name="imgInit" 的控件是IE下的用法,最好能避免
var imgInit=document.getElementsByName('imgInit')[0]
//从贴出的代码看,这个段代码是纯js代码并不需要服务器处理啊
//错误在哪一句
name=imgInit
属性尽量放进双引号中
直接用变量imgInit来访问name="imgInit" 的控件是IE下的用法,最好能避免
var imgInit=document.getElementsByName('imgInit')[0]
//从贴出的代码看,这个段代码是纯js代码并不需要服务器处理啊
//错误在哪一句
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询