asp.net里插入js代码问题 我想在页面上放一个js的轮换图片,在html里好好的,复制过来插入到aspx页面就能用了,提示说找不到某个对象. 大家帮下忙,谢谢!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在<head>里引入的js文件------------var elady_step=3; //1:small, 3:middle, 5:bigvar elady_speed=50; //20:fast, 50:middle, 80:slowvar e_tp=new Array();var e_tplink=new Array();var adNum_elady1=0; var elady_stop_sh=0;var elady_star_sh=1;function elady1_moveImg(){if ((!document.all&&!document.getElementById)||(elady_stop_sh==0)) return;if (elady_star_sh==1){document.all.elady1_divimg.style.pixelTop=parseInt(document.all.elady1_divimg.style.pixelTop)+elady_step;}else if (elady_star_sh==2){document.all.elady1_divimg.style.pixelLeft=parseInt(document.all.elady1_divimg.style.pixelLeft)+elady_step;}else if (elady_star_sh==3){document.all.elady1_divimg.style.pixelTop=parseInt(document.all.elady1_divimg.style.pixelTop)-elady_step;}else{document.all.elady1_divimg.style.pixelLeft=parseInt(document.all.elady1_divimg.style.pixelLeft)-elady_step;}if (elady_star_sh<4) elady_star_sh++;else elady_star_sh=1;setTimeout("elady1_moveImg()",elady_speed);}e_tplink[0]="http://www.licns.com";e_tp[0]="http://et.21cn.com/portray/images/if/01.jpg";e_tplink[1]="http://www.licns.com";e_tp[1]="http://et.21cn.com/portray/images/if/02.jpg";e_tplink[2]="http://www.licns.com";e_tp[2]="http://et.21cn.com/portray/images/if/03.jpg";e_tplink[3]="http://www.licns.com";e_tp[3]="http://et.21cn.com/portray/images/if/04.jpg";var currentimage=new Array(); for (i=0;i<=3;i++){currentimage[i]=new Image(); currentimage[i].src=e_tp[i]; } function elady1_set(){ if (document.all) { e_tprotator.filters.revealTrans.Transition=Math.floor(Math.random()*23); e_tprotator.filters.revealTrans.apply(); } } function elady1_playCo() { if (document.all) e_tprotator.filters.revealTrans.play() }function elady1_nextAd(){ if(adNum_elady1<e_tp.length-1)adNum_elady1++ ; else adNum_elady1=0; elady1_set(); document.images.e_tprotator.src=e_tp[adNum_elady1]; elady1_playCo(); theTimer=setTimeout("elady1_nextAd()", 4000);} function elady1_linkurl(){ jumpUrl=e_tplink[adNum_elady1]; jumpTarget='_blank'; if (jumpUrl != ''){ if (jumpTarget != '')window.open(jumpUrl,jumpTarget); else location.href=jumpUrl; }}function elady1_listMsg() { status=e_tplink[adNum_elady1];document.returnValue = true;}下面是调用---------------------------------------<table height="225" cellSpacing="0" cellPadding="0" width="631" border="0"> <tr> <td width="280" height="225"> <div id='elady1_divimg' style='position:relative'> <a onMouseOver="elady1_listMsg();return document.returnValue" href="javascript:elady1_linkurl()" target="_self"> <img style="FILTER: revealTrans(duration=2,transition=20)" src="javascript:elady1_nextAd()" border=0 id="e_tprotator" runat=server onMouseout="elady_stop_sh=0" ></a> </div> </td> <td width="351" height="225"><FONT face="宋体"></FONT></td> </tr> </table> 提示错误是:找不到e_tprotator这个对象 改一下编码就行了...改js的UTF-8 有的说把aspx页面编码改成gb2312,但改了还是不行 将js文件用notepad打开,另存为UTF-8编码试试 lz用的是2005?编译运行之后凡是带runat="server"的控件都会重新命名,你查看一下源文件看看原来id是e_tprotator的控件变成了什么,然后把那个id改一下就好了 去掉这个试试:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 看看sina 财经频道的,它是用的flash制作的,你只需照它的作,然后在page_load事件中生成 图片链接字符串 链接字符串 提示字符串 就ok了 太长了没仔细看~不知道回答了没有~~不过要注意是在form1里的~~比如原来叫作btnsubmit现在要用form1.btnsubmit 把脚本里的e_tprotator 换为document.all('e_tprotator')试试看。 怎么重新赋值给DropDownList? IE浏览器问题 owc 柱形图 标注数据 循环连接字符串的问题!————————————————急! 请教一个论坛的问题 怎样启用 sa 登录 asp.net2.0中,怎么得到自定义控件的公共属性? 请教一个多session的问题 如何用javascript写 zilong28:请教各位大侠这是什么错误Server Error in '/' Application. 帮个忙. 100分再问关于线程池的问题
------------
var elady_step=3; //1:small, 3:middle, 5:big
var elady_speed=50; //20:fast, 50:middle, 80:slow
var e_tp=new Array();
var e_tplink=new Array();
var adNum_elady1=0;
var elady_stop_sh=0;
var elady_star_sh=1;function elady1_moveImg(){
if ((!document.all&&!document.getElementById)||(elady_stop_sh==0)) return;
if (elady_star_sh==1){
document.all.elady1_divimg.style.pixelTop=parseInt(document.all.elady1_divimg.style.pixelTop)+elady_step;}
else if (elady_star_sh==2){
document.all.elady1_divimg.style.pixelLeft=parseInt(document.all.elady1_divimg.style.pixelLeft)+elady_step;}
else if (elady_star_sh==3){
document.all.elady1_divimg.style.pixelTop=parseInt(document.all.elady1_divimg.style.pixelTop)-elady_step;}
else{
document.all.elady1_divimg.style.pixelLeft=parseInt(document.all.elady1_divimg.style.pixelLeft)-elady_step;}
if (elady_star_sh<4) elady_star_sh++;
else elady_star_sh=1;
setTimeout("elady1_moveImg()",elady_speed);}e_tplink[0]="http://www.licns.com";
e_tp[0]="http://et.21cn.com/portray/images/if/01.jpg";
e_tplink[1]="http://www.licns.com";
e_tp[1]="http://et.21cn.com/portray/images/if/02.jpg";
e_tplink[2]="http://www.licns.com";
e_tp[2]="http://et.21cn.com/portray/images/if/03.jpg";
e_tplink[3]="http://www.licns.com";
e_tp[3]="http://et.21cn.com/portray/images/if/04.jpg";var currentimage=new Array();
for (i=0;i<=3;i++){currentimage[i]=new Image();
currentimage[i].src=e_tp[i];
}
function elady1_set(){ if (document.all)
{ e_tprotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);
e_tprotator.filters.revealTrans.apply(); }
}
function elady1_playCo()
{ if (document.all) e_tprotator.filters.revealTrans.play()
}function elady1_nextAd(){ if(adNum_elady1<e_tp.length-1)adNum_elady1++ ;
else adNum_elady1=0;
elady1_set();
document.images.e_tprotator.src=e_tp[adNum_elady1];
elady1_playCo();
theTimer=setTimeout("elady1_nextAd()", 4000);}
function elady1_linkurl(){ jumpUrl=e_tplink[adNum_elady1];
jumpTarget='_blank';
if (jumpUrl != ''){ if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
else location.href=jumpUrl;
}}
function elady1_listMsg()
{ status=e_tplink[adNum_elady1];
document.returnValue = true;}下面是调用
---------------------------------------
<table height="225" cellSpacing="0" cellPadding="0" width="631" border="0">
<tr>
<td width="280" height="225">
<div id='elady1_divimg' style='position:relative'>
<a onMouseOver="elady1_listMsg();return document.returnValue" href="javascript:elady1_linkurl()" target="_self">
<img style="FILTER: revealTrans(duration=2,transition=20)" src="javascript:elady1_nextAd()" border=0 id="e_tprotator" runat=server onMouseout="elady_stop_sh=0" ></a>
</div>
</td>
<td width="351" height="225"><FONT face="宋体"></FONT></td>
</tr>
</table>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
生成 图片链接字符串 链接字符串 提示字符串 就ok了
不过要注意是在form1里的~~比如原来叫作btnsubmit
现在要用form1.btnsubmit