document.getElementById("foucs_l_"+df).onmouseover=function(){
...
}

解决方案 »

  1.   

    可以document.getElementById("foucs_l_"+df).onmouseover();
      

  2.   


    var foucssp=30;
    var foucs_hidden=1;
    function foucs()
    {
    fh=foucs_hidden;
    for (var i=1; i<5; i++)
    {
    if (i==fh && i <4)
    {
    df=i+1;
    }else{
    df=1;
    }
    document.getElementById("foucs_l_"+df).onMouseOver();
    foucs_hidden=df;
    }
    }
    setTimeout("foucs()",foucssp*10);
    1楼的
    他事件要执行的过程已经被重写了
    我就是想要通过这个事件 调用下被重写的函数2楼
    Error:对象不支持此属性或方法
      

  3.   

    对呀!给你看个我写的:function writeYourReview(){
          var writereviewbtn1=document.getElementById("reviewbtn");
          writereviewbtn1.onclick=function(){
                              takeOnForm("commentdiv");
          }
          var closereviewbtn6=document.getElementById("closebtn6")
          closereviewbtn6.onclick=function(){
                              closehiddenlayer("commentdiv");
          }
          return;
    }
    只不过针对事件不同而已!我理解错了:(
      

  4.   

    1. 你有没定义 onmouseover 事件?2. 事件名是小写的.
      

  5.   


    明白你意思
    我也知道这样
    你的这一步已经被执行过来比如 我在你的这个事件的基础上
    我要让js自动执行 onclick 事件
      

  6.   

    放大招...
    从网易弄得轮换图片
    个人感觉效果挺好,就是不会自己变动 需要手动 ,现在要改为自动变换页面代码<DIV class="focusPic clearfix">
                <DIV id=focus_tab1>
                <DIV class="pic none on"><A href="http://news.163.com/09/0423/10/57J2PMGG00013AN0.html"><IMG height=314 alt=青岛市民等候海上阅兵活动 src="images/p_1.gif" width=290 border=0></A> 
                      <H5><A href="http://news.163.com/09/0423/10/57J2PMGG00013AN0.html">青岛市民等候海上阅兵活动</A></H5>
    </DIV>
                <DIV class="pic none "><A href="http://news.163.com/09/0423/09/57IS7UFO00013AN0.html"><IMG height=314 alt=所有国外参阅舰艇出港完毕 src="images/p_2.gif" width=290 border=0></A> 
                 <H5><A href="http://news.163.com/09/0423/09/57IS7UFO00013AN0.html">所有国外参阅舰艇出港完毕</A></H5>
    </DIV>
                <DIV class="pic none "><A href="http://war.news.163.com/09/0422/17/57H6MH3I00011MTO.html"><IMG height=314 alt=各国海军军舰对青岛市民开放 src="images/p_1.gif" width=290 border=0></A> 
                 <H5><A href="http://war.news.163.com/09/0422/17/57H6MH3I00011MTO.html">各国海军军舰对青岛市民开放</A></H5>
    </DIV>
    <DIV class="pic none "><A href="http://news.163.com/09/0423/09/57IS7UFO00013AN0.html"><IMG height=314 alt=所有国外参阅舰艇出港完毕 src="images/p_2.gif" width=290 border=0></A> 
                 <H5><A href="http://news.163.com/09/0423/09/57IS7UFO00013AN0.html">所有国外参阅舰艇出港完毕</A></H5>
    </DIV>
    </DIV>
                <DIV class=focusNum>
                   <UL id=menu_bar1>
                       <LI class=on id="foucs_l_1">1 </LI>
                       <LI id="foucs_l_2">2 </LI>
                       <LI id="foucs_l_3">3 </LI>
       <LI id="foucs_l_4">4 </LI>
       </UL>
     </DIV>
    </DIV>
    调用代码<SCRIPT language=javascript src="js/foucspic.js" type=text/javascript charset=gb2312></SCRIPT><SCRIPT language=JavaScript type=text/javascript>
                //<![CDATA[
                //切换表单
                var news_tab = new NTES.UI.Slide(NTES("#menu_bar1 > li"), NTES("#focus_tab1 > div"), "on", "mouseover");
                //end
                //]]>
    var foucssp=30;
    var foucs_hidden=1;
    function foucs()
    {
    fh=foucs_hidden;
    for (var i=1; i<5; i++)
    {
    if (i==fh && i <4)
    {
    df=i+1;
    }else{
    df=1;
    }
    document.getElementById("foucs_l_"+df).onmouseover();
    foucs_hidden=df;
    }
    }
    setTimeout("foucs()",foucssp*10);
    </SCRIPT>  
      

  7.   

    foucspic.js 代码(function(){var A=window.NTES=window.$=function($,B){if(!$||$.$)return $;var C;if("string"==typeof $){if(!B&&!this.alert)B=this;B=B||document;C=_.query($,B)}else C=$;if(C&&!C.$)if(C.nodeType&&"unknown"!=typeof C.getAttribute)C=A.Util.extend(C,A.Element);else C=A.Util.extend(A.Util.toArray(C),A.Element);return C};A.version="0.9.5.6";A.Element={$:function($,_){return window.$.call(this,$,_)},addCss:function(D){D=$.parse(D);var A=this.toArray(),C=D.length,E=-1,B,_=A.length;switch(D.type){case"class":while(++E<C){B=-1;while(++B<_)if(!A[B].className.has(D[E]," "))A[B].className=""==A[B].className?D[E]:A[B].className+" "+D[E]}break;case"style":while(++E<_){B=0;while(B<C)if(A[E].style[D[B]]!=null)A[E].style[D[B++]]=D[B++].replace(/^NULL$/i,"");else B+=2}break}return this},removeCss:function(E){E=$.parse(E);var B=this.toArray(),D=E.length,F=-1,C,A=B.length;if("class"==E.type){var _;while(++F<D){C=-1;_=" "+E[F]+" ";while(++C<A)B[C].className=(" "+B[C].className+" ").replace(_," ").trim()}}else while(++F<A){C=D;while(--C>=0)if(B[F].style[E[C]]!=null)B[F].style[E[C]]=""}return this},addEvent:function($,B){var _=this.toArray(),A=_.length;while(--A>=0)if(window.addEventListener)_[A].addEventListener($,B,false);else if(window.attachEvent)_[A].attachEvent("on"+$,B);return this},toArray:function(){if(E(this))return this;else return[this]}};var _={SPACE:/\s*([\s>,]|^|$)\s*/g,IMPLIEDALL:/([\s>,]|^)([@.#])/g,BEGINIDAPART:/^(?:\*(#[\w-]+))?(.*)/,ATTRIBUTE:/\[([\w-]+)\s*(\W?=)?\s*([^\]]*)\]/g,STREAM:/[\s#.>@]|[^\s#.>@]+/g,STANDARD:/^[\s>]/,ISSIMPLE:/^(?:(?:#?[\w-]+)|\*)$/,tempAtts:[],parse:function($){return $.replace(this.SPACE,"$1").replace(this.ATTRIBUTE,this.replaceAtts).replace(this.IMPLIEDALL,"$1*$2")},replaceAtts:function(A,C,B,$){return"@"+(_.tempAtts.push([C,B,$])-1)},toStream:function($){if(!this.STANDARD.test($))$=" "+$;return $.match(this.STREAM)||[]},operators:{"#":function(_,$){return this["@"](_,["id","=",$])}," ":function(C,A){var _=[],G=-1,E=C.length,F,$,D,B=0;while(++G<E){$=C[G].getElementsByTagName(A);D=$.length;F=-1;while(++F<D)_[B++]=$[F]}return _},".":function($,_){return this["@"]($,["class","~=",_])},"@":function(B,D){if(D!=null&&!isNaN(D))D=_.tempAtts[D];var $=[],E=-1,C=B.length,A=0;while(++E<C)if(_.compareAttribute(B[E],D))$[A++]=B[E];return $},">":function(C,E){var A=[],$,F=-1,D=C.length,B=0;E=null==E||""==E?"*":E.toUpperCase();while(++F<D){$=C[F].firstChild;while($){if($.nodeName==E||("*"==E&&!_.isBlank($)))A[B++]=$;$=$.nextSibling}}return A}},attributes:{"":function($){return $!=null},"=":function(_,$){return $===_},"~=":function(_,$){return $!=null&&_!=null&&_.has($," ")},"!=":function(_,$){return $!=_}},getAttribute:function($,_){var A;if(typeof $.getAttributeNode!="undefined"){A=$.getAttributeNode(_);A=null==A?A:A.value}else if($.attributes!=null)A=$.attributes[_];return""==A?null:A},compareAttribute:function($,A){var _;if(A){A[1]=A[1]||"";if("\"\""==A[2]||"''"==A[2])A[2]="";_=this.getAttribute($,A[0]);if(this.attributes[A[1]]&&this.attributes[A[1]](_,A[2]))return true}else if(!this.isBlank($))return true},isBlank:function($){switch($.nodeType){case 1:if(!$.tagName||"!"==$.tagName)return true;break;case 3:if(!/\S/.test($.nodeValue))return true;break;case 8:return true;case 10:return true}},query:function($,I){var _,G,C,B,D,J,L,H,K,F;if(this.ISSIMPLE.test($))if(0==$.indexOf("#")){if("undefined"!=typeof I.getElementById){$=$.substr(1);_=I.getElementById($);if(_&&this.getAttribute(_,"id")!=$){_=document.all[$];for(C=0,len=_.length;C<len;C++)if(this.getAttribute(_[C],"id")===$)return _[C];_=null}return _}}else if("undefined"!=typeof I.getElementsByTagName)return A.Util.toArray(I.getElementsByTagName($));if(!E(I))I=I.nodeType?[I]:A.Util.toArray(I);G=this.parse($).split(",");D=G.length;C=-1;_=[];while(++C<D){J=I;K=G[C].match(this.BEGINIDAPART);if(K[1]!=null&&K[1]!="")if("undefined"!=typeof J[0].getElementById){J=[this.query(K[1],J[0])];if(!J[0])continue}else K[2]=G[C];if(K[2]!=null&&K[2]!=""){K=this.toStream(K[2]);F=K.length;B=0;while(B<F){H=K[B++];L=K[B++];if(this.operators[H])J=this.operators[H](J,L);else J=[];if(0==J.length)break}}_=_.merge(J)}return _}},$={JSSTYLENAME:/\-([a-z])/gi,SPLITER:/[^:;]+/g,SPACE:/\s+([:;\s])\s+/,parse:function(A){var _=A.indexOf(";")!=-1,$=A.indexOf(":")!=-1;if(_||$){A=A.replace(this.JSSTYLENAME,function($,_){return _.toUpperCase()}).replace(this.SPACE,"$1").match(this.SPLITER);if($){A.type="style";if(A.length%2!=0)throw new Error("invalid inline style")}else A.type="stylename"}else{A=A.split(/\s/);A.type="class"}return A}},E=function($){return Object.prototype.toString.call($)==="[object Array]"},D=/#@(\w+)#/g;A.Util={toArray:function($){if(E($))return $;else if($.toArray)return $.toArray();else{var _=[],A=$.length;while(A)_[--A]=$[A];return _}},parseTpl:function(_,$,A){return $?String(_).replace(A||D,function(_,A){return $[A]!=null?$[A]:_}):_},extend:function($,A){for(var _ in A)$[_]=A[_];return $}};var C=navigator.userAgent.toLowerCase();A.Browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};A.Ajax={createXhr:function(){var _;try{_=window.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()}catch($){}if(!_)throw new Error("failed to create an XMLHttpRequest object");return _},send:function(E,C,B,F,A){A=A||this.createXhr(),hasCompleted=false;C=C.toUpperCase();C=C!="GET"&&C!="POST"?"GET":C;F=F||{};F.async="boolean"==typeof F.async?F.async:true;var _;if(B){_=[];for(var $ in B)_.push($+"="+encodeURIComponent(B[$]));_=_.join("&").replace(/%20/g,"+")}if(F.async&&!isNaN(F.timeout)&&F.timeout>0)setTimeout(function(){if(!hasCompleted){A.abort();if(F.onTimeout)F.onTimeout(A)}},F.timeout);A.onreadystatechange=function(){if(4==A.readyState){hasCompleted=true;var $=200==A.status?"onSuccess":"onError";if(F[$])F[$](A)}};if(_&&"GET"==C){E+=("?"+_);_=null}A.open(C,E,F.async,F.username,F.password);if(F.headers)for(var D in F.headers)A.setRequestHeader(D,F.headers[D]);if("POST"==C)A.setRequestHeader("Content-Type","application/x-www-form-urlencoded");A.send(_);return A},importJs:function(C,$,_){var B=document.getElementsByTagName("head")[0],A=document.createElement("script");A.src=C;A.language="javascript";A.type="text/javascript";if(_)A.charset=_;A.onload=A.onreadystatechange=function(){if(!this.readyState||this.readyState=="loaded"||this.readyState=="complete"){if($)$(this);this.parentNode.removeChild(A)}};B.appendChild(A)}};A.Cookie={encoder:escape,decoder:unescape,get:function(A){A=this.encoder(A)+"=";var $=document.cookie,_=$.indexOf(A);if(-1==_)return"";_+=A.length;var B=$.indexOf(";",_);if(B==-1)B=$.length;return this.decoder($.substring(_,B))},set:function(A,E,$,D,C,B){var _=[this.encoder(A)+"="+this.encoder(E)];if($){var F;if(!isNaN($)){F=new Date();F.setTime(F.getTime()+$*60*1000)}else F=$;
      

  8.   


    _.push("expires="+F.toUTCString())}if(C!=null&&C!="")_.push("path="+C);if(D)_.push("domain="+D);if(B)_.push("secure");document.cookie=_.join(";")},del:function($,A,_){document.cookie=this.encoder($)+"="+(_!=null&&_!=""?";path="+_:"")+(A?";domain="+A:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT"}};A.Event={fix:function(_){_.preventDefault=_.preventDefault||function(){_.returnValue=false};if(null==_.pageX&&null!=_.clientX){var A=document.documentElement,$=document.body;_.pageX=_.clientX+(A.scrollLeft||$.scrollLeft||0)-(A.clientLeft||0);_.pageY=_.clientY+(A.scrollTop||$.scrollTop||0)-(A.clientTop||0)}return _}};var B=function(_,$){return(_+1)%$};A.UI={Slide:function(O,D,S,P,C){var $=D.length;if(O&&$!=O.length)throw new Error("can not match ctrls("+O.length+") and contents("+$+")");var K=-1,_,G,Q,F=B,R,I,H,N;O=A(O||[]);D=A(D);this.setPlayMode=function($){F=$};this.setOnShow=function($){Q=$};I=this.show=function(A){if(A>=0&&A<$&&A!=K){var B=O[A],_=D[A];O.removeCss(S);D.removeCss(S);if(B)B.addCss(S);_.addCss(S);K=A;if(Q)Q(A,B,_)}};G=this.showNext=function(){if(-1==K)K=0;I(F(K,$))};H=this.play=function($){if(!isNaN($))C=$;if(null==_){if(!R){O.addEvent("mouseover",N);O.addEvent("mouseout",H);D.addEvent("mouseover",N);D.addEvent("mouseout",H);R=true}_=setInterval(G,C)}};N=this.pause=function(){if(_!=null){clearInterval(_);_=null}};var E=function(_){I(this);var $=A.Event.fix(_);$.preventDefault();$.cancelBubble=true};for(var J,M,L=D.length-1;L>=0;L--){J=O[L];D[L]=A(D[L]);if(J){O[L]=A(J);if(P)J.addEvent(P,E.bind(new Number(L)))}}if(C>0)H()}};String.prototype.trim=function($){switch(typeof $){case"undefined":return this.replace(/(^\s*)|(\s*$)/g,"");case"string":return this.replace(new RegExp("(^"+$+"*)|("+$+"*$)","g"),"");default:return this}};String.prototype.has=function($,_){return"string"==typeof _?(_+this+_).indexOf(_+$+_)!=-1:this.indexOf($)!=-1};String.format=function($){var _=arguments,A=new RegExp("%([1-"+_.length+"])","g");return String($).replace(A,function($,A){return _[A]})};Function.prototype.bind=function(){if(!arguments.length||null==arguments[0])return this;var _=this,$=Array.prototype.slice.call(arguments),A=$.shift();return function(){return _.apply(A,$.concat(Array.prototype.slice.call(arguments)))}};Array.prototype.indexOf=Array.prototype.indexOf||function($,_){var B=isNaN(_)||_<0?-1:_-1,A=this.length;while(++B<A)if(this[B]==$)return B;return-1};Array.prototype.merge=function($){var A=-1,_=$.length;while(++A<_)if(-1==this.indexOf($[A]))this.push($[A]);return this};window.toArray=document.toArray=function(){return[this]};window.addEvent=document.addEvent=A.Element.addEvent})();
      

  9.   

    参考效果:http://war.news.163.com/special/00013ACT/423military_review.html
    就他这个轮换图片
    他已经重载过 onmouseover 效果了
    但不能自动轮换我想给他加个代码 通过执行 1 2 3的 onmouseover 事件 执行他重载的事件 达到变换的效果
    有高手给我解决下这个问题也行 或者是看看我解决的方法...
      

  10.   


    他本来就有这功能的 var news_tab = new NTES.UI.Slide(NTES("#menu_bar1 > li"), NTES("#focus_tab1 > div"), "on", "mouseover", 3000);最后面的是播放间隔