MM_swapImgRestore() not working on Mozilla

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • swatiminiyar
    New Member
    • Nov 2008
    • 4

    MM_swapImgRestore() not working on Mozilla

    I am using using MM_swapImgResto re() fiunction for highlighting the selected tab.
    but this is working fine on IE and not working on mozilla .

    Onmouseout oif tabs im calling this function.

    Code:
    function MM_swapImgRestore()
    {   //v3.0 
       
       var i,x,a=document.MM_sr;
         for(i=0; a&&i<a.length&&(x=a[i])&&x.oSrc;i++) 
       { 
    		switch(document.topPanelForm.tabval.value)
    	   {
    			case 1:
    				document.topPanelForm.tabval.value="";
    				x.src=x.src;
    			     break;
    			case 2:
    				document.topPanelForm.tabval.value="";
    				x.src=x.src;
    			     break;
    			case 3:
    				document.topPanelForm.tabval.value="";
    				x.src=x.src;
    			    break;
    			case 4:
    				document.topPanelForm.tabval.value="";
    				x.src=x.src;
    			     break;
    			case 5:
    				document.topPanelForm.tabval.value="";
    				x.src=x.src;
    			    break;
    			default:x.src=x.oSrc;
    			     break;
    			
    	   }
    
       }
    }
    Please help me out
    Last edited by gits; Nov 12 '08, 08:54 AM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    you are lucky that it is not working in mozilla ;) ... download the firebug extension or have a look at the JavaScript-error-console of MOZ/FF and tell us what error occurs ... may be you see for yourself what to do when you see the error-message

    kind regards

    Comment

    • swatiminiyar
      New Member
      • Nov 2008
      • 4

      #3
      Originally posted by gits
      you are lucky that it is not working in mozilla ;) ... download the firebug extension or have a look at the JavaScript-error-console of MOZ/FF and tell us what error occurs ... may be you see for yourself what to do when you see the error-message

      kind regards
      I have checked for errors in "mozilla" with fiebug.Its not giving any errors.I have given alerts in the to trace the execution of fun.but it simply not not entering in the for loop.Dont know why?

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        then check where document.MM_sr is set ... may be that fails for FF? you may alert it in the posted script and it could be that document.MM_sr. length is 0?

        kind regards

        Comment

        • gits
          Recognized Expert Moderator Expert
          • May 2007
          • 5388

          #5
          btw. by looking at your code it seems that this switch could be shortened to:

          Code:
          var value = document.topPanelForm.tabval.value;
          switch(value) {
              case 1:
              case 2:
              case 3:
              case 4:
              case 5:
                  value = '';
                  x.src = x.src;
                  break;
              default:
                  x.src = x.oSrc;
                  break;
          }
          or even better with an if as there are just 2 cases:

          Code:
          var value = document.topPanelForm.tabval.value;
          if (value in { 1:1, 2:1, 3:1, 4:1, 5:1 }) {
              value = '';
              x.src = x.src;
          } else {
              x.src = x.oSrc;
          }
          kind regards

          Comment

          Working...