Your Ad Here Your Ad Here
Results 1 to 3 of 3

Thread: Javascript Problem - Changing Event

  1. #1
    SaveFerris's Avatar ŻŻŻŻŻŻŻŻŻŻŻŻ
    Join Date
    Oct 2006
    Location
    England
    Posts
    224
    I'm having problems changing the event of some elements. This following code works perfectly fine in Firefox:
    HTML Code:
    workin.attributes["onmouseover"].value = b2use+"(this.id)"
    workin.attributes["onclick"].value = b2use+"2(this.id)"
    But it doesn't work in IE, can someone help me with changing the event for IE?
    Thank you.

    PS. Anyone who is going to say use workin.onclick, don't bother. It doesn't work with functions that require parameters.

  2. Internet, Programming and Graphics   -   #2
    tesco's Avatar woowoo
    Join Date
    Aug 2003
    Location
    Canadia
    Posts
    24,069
    I thought about it for a while and maybe you could make it call a function with no paramater using workin.onclick and that function that is called will then call another function WITH parameter?

    An example:
    HTML Code:
    <script type="text/javascript">
    <!--
    document.getElementById('whatever').onclick = "var param='whatever';newfunction();";
    
    function newfunction()
    {
        return therealfunctionwithaparam(param);
    }
    
    function therealfunctionwithaparam(param)
    {
        dowhateverhere();
        return param;
    }
    //-->
    </script>

  3. Internet, Programming and Graphics   -   #3
    SaveFerris's Avatar ŻŻŻŻŻŻŻŻŻŻŻŻ
    Join Date
    Oct 2006
    Location
    England
    Posts
    224
    Wow, that makes sense. Thanks Rossco, I'll edit/repost once I've tried.

    Nope, didn't work.
    Last edited by SaveFerris; 04-09-2007 at 06:47 AM. Reason: Automerged Doublepost

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •