Web Analytics Made Easy -
StatCounter Script is too long, is there another possibility - CodingForum

Announcement

Collapse
No announcement yet.

Script is too long, is there another possibility

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script is too long, is there another possibility

    Hi folks

    is there a way of compacting the functions with another method, with 500 divs the page would never load



    Code:
    <script type="text/javascript">
    function on1 () {
      if (document.getElementById)
        document.getElementById("fo-test").style.visibility = "visible"; }
        
    function do1 () {
      if (document.getElementById)
    	document.getElementById("fo-test").style.visibility = "hidden";
    }
    function on2 () {
      if (document.getElementById)
        document.getElementById("fo-test2").style.visibility = "visible"; }
        
    function do2 () {
      if (document.getElementById)
    	document.getElementById("fo-test2").style.visibility = "hidden";
    }
    function on3 () {
      if (document.getElementById)
        document.getElementById("fo-test3").style.visibility = "visible"; }
        
    function do3 () {
      if (document.getElementById)
    	document.getElementById("fo-test3").style.visibility = "hidden";
    }
    </script> 
    
    ***example***
    
    <div onmouseover="this.className='ts-1-1over';javascript:on1();" onmouseout="this.className='ts-1-1';javascript:do1();"<object id="fo-test" style="visibility:hidden"  classid=" ect..ect...></div>
    
    <div onmouseover="this.className='ts-1-1over';javascript:on2();" onmouseout="this.className='ts-1-1';javascript:do2();"<object id="fo-test" style="visibility:hidden"  classid=" ect..ect...></div>

    thx

  • #2
    I think this might help you:
    Code:
    <script type="text/javascript">
    function on (num) {
      if (document.getElementById)
        document.getElementById("fo-test"+num).style.visibility = "visible"; }
        
    function do (num) {
      if (document.getElementById)
    	document.getElementById("fo-test"+num).style.visibility = "hidden";
    }
    </script> 
    
    ***example***
    
    <div onmouseover="this.className='ts-1-1over';javascript:on('');" onmouseout="this.className='ts-1-1';javascript:do('');"<object id="fo-test" style="visibility:hidden"  classid=" ect..ect...></div>
    
    <div onmouseover="this.className='ts-1-1over';javascript:on(2);" onmouseout="this.className='ts-1-1';javascript:do(2);"<object id="fo-test" style="visibility:hidden"  classid=" ect..ect...></div>
    Shedokan - Free Online Games

    Comment

    Working...
    X