problem with onLoad - help please!

Discussion in 'JavaScript' started by publicidadpixelada, Feb 6, 2007.

  1. #1
    I have a script that looks like this:
    <script type="text/javascript">
    function ss(a, id) {
         somestuff;
    }
    function jcc(id) {
         somestuff;
    }
    </script>
    Code (markup):
    And a link that looks like this:
    <a id ="omg" href ="http://google.com" onFocus = "ss('go to www.google.com','omg')" onMouseOver = "return ss('go to www.google.com','omg')" onClick = "jcc('omg')"> <img src="small.gif" width="500" height="300"></a>
    Code (markup):
    It works perfect, when you click/focus/point the link javascript is executed.. But I wan't to do all onLoad instead of waiting the user to click on the link. I tried using this:
    <a onLoad="ss('go to www.google.com','omg');return ss('go to www.google.com','omg');jcc('omg')" href...> 
    Code (markup):
    But it didn't worked, any other suggestion to transform onFocus, onMouseOver, onClick to onLoad?

    Thanks in advanced!
     
    publicidadpixelada, Feb 6, 2007 IP
  2. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #2
    Try adding onload to your HTML body:

    
    <body onLoad="ss('go to www.google.com','omg');return ss('go to www.google.com','omg');jcc('omg')">
    
    ..... 
    
    </body>
    
    Code (markup):
     
    ajsa52, Feb 7, 2007 IP
  3. publicidadpixelada

    publicidadpixelada Peon

    Messages:
    84
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks ajsa52
     
    publicidadpixelada, Feb 7, 2007 IP