Results 1 to 7 of 7

Thread: Using multiple onMouseOver Events

  1. #1
    Join Date
    Jun 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Using multiple onMouseOver Events

    1) Script Title:Using multiple onMouseOver Events

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...criptsound.htm

    3) Describe problem: On my page I have 2 images that require onMouseOver. One is a link button that changes images, the other is an image that changes to another image and plays a sound upon mouse over. Link button worked fine until I added the second thing. I have them coded as two different scripts in the head section. I'm new to Javascript and am not sure how to make both work together, it seems the one is canceling out the other. I wasn't sure how to post my code, that's why it's not here.

  2. #2
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    In general, you seperate multiple functions to invoke within a same event handler using a semicolon. For example:

    Code:
    <a href="#" onMouseover="dothis(); dothat()">

  3. #3
    Join Date
    Aug 2007
    Location
    Barcelona
    Posts
    28
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question onMouseOver - rollover button with window.status text & timeout

    Hi. I have a similar problem that I canīt manage to solve myself even after many inet searches on the subject. The code I have is:

    <a href="homepage.htm" target="main"
    onMouseOver="home.src='../images/buttons/homebutton_over.gif';
    window.status='Return to the Home Page', 8000; return true";
    onMouseOut="home.src='../images/buttons/homebutton.gif';
    window.status= ' '"; return true>
    <img src="../images/buttons/homebutton.gif" border="0" name="home"></a>

    The rollover button works fine. Itīs the window.status + time that I need the help with. Within this code is the window.status code where I want the text "Return to Home Page" to last for 8 seconds before timing out of showing on the status bar.

    This code is obviously wrong because it doesnīt work! What have I done wrong? Hope somebody can help.

    Many thanks from a newbie.

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That is not a valid parameter of window.status to begin with, and wouldn't work even if used just by itself. You would need a separate function to give you that sort of capability. For example, have something like so in the head of the page:

    Code:
    <script type="text/javascript">
    function status_timer (txt, ti){
    window.status=txt;
    setTimeout(function(){window.status=''}, ti);
    }
    </script>
    Then you could do something like this:

    Code:
    <a href="#"
    onmouseover="home.src='some.gif';status_timer('This is a test',8000);return false;"> . . .
    Even so, many modern browsers are set to not allow manipulation of the status bar via javascript.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #5
    Join Date
    Aug 2007
    Location
    Barcelona
    Posts
    28
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Thank you John. I&#180;ll give that a go

    As a newbie to this, is it possible to explain more about the modern browser issue that you mentioned? Many thanks.
    Last edited by susie123; 08-14-2007 at 10:35 AM. Reason: After-thought

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    It's a security feature. The thinking is that if you cannot see what a link does (a default action of the status bar) you may be able to be sent to a phishing site, thinking that it is actually the official site of a bank or other institution with which you might share confidential information.

    To prevent this, FF, IE, and Opera - probably others, now have it at least as an option to disable the manipulation of the status bar via javascript.

    Another less vital reason for this is that many folks just prefer that their status bar be left alone. Some sites go so far as to place animated marquees in the status, for example. This is very annoying to many people. Being able to turn that off is nice.

    Another aspect of this is that most modern browsers also allow the status bar to be turned off completely by the user. In a case like that, your code would do nothing, as there would be nothing to do it to.

    So, basically this is just another feature (the ability to configure the status bar and keep it out of the hands of the site designers) designed to allow the user to control their browsing experience.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #7
    Join Date
    Aug 2007
    Location
    Barcelona
    Posts
    28
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Talking

    Thank you so much John for the explanation. Itīs all a lot clearer now

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
  •