SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    function for the status line problem

    Instead of writing onmouseover="status='my status here'; return true;" for every link I wanted to make a function that would also reduce filesize.


    -------------------------------------------------------------
    function stOn(statusLine) {status='statusLine'; return true;}

    adn then I would add this to my HTML file:

    <a href="pictures.html" onmouseover="stOn('pictures')">pictures</a>
    -------------------------------------------------------------


    since this didn't work I tried one step back:


    -----------------------------------------------------------
    function stOn() {status='whatever'; return true;}

    <a href="whatever.html" onmouseover="stOn()">whatever</a>
    -----------------------------------------------------------
    and even this didn't work!
    where did I go wrong?

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your first one is ok except for the fact that you surrounded your variable with single-quotes, remove those suckas. Next, add the window.

    function stOn(statusLine) {window.status=statusLine; return true;}
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    did what you said. still doesn't work :(

    Well... I don't think that window addition doesnt matter, because onmouseover="status='whatever'" works just fine but I added it anyways.

    Secondly I edited my code so that it looks like this but still doesn't work:

    ------------------------------------------------------------------
    function stOn(statusLine) {window.status = statusLine; return true;}

    <a href="whatever.htm" onmouseover="stOn('whatever')">Whatever</a>
    ------------------------------------------------------------------

  4. #4
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I seem to remember reading someplace that certain versions of IE needed a slight delay for this to work right. Give this a shot...

    function stOn(statusLine) {
    setTimeout("window.status = statusLine;",1);
    return true;
    }
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev




  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I didn't even try the code on another browser . So now I did. Works OK on Opera.

    But still not in IE. I have debugging mode turned on in IE and when I change my code according to you, IE shows an error: 'statusLine' is undefined. WTF?!

    So I tried something else just in case it might work (a little modification on your code):

    ---------------------------------------------------------------------
    function stOn(statusLine) {
    setTimeout("stOn2",1);
    function stOn2(statusLine) {window.status = statusLine;return true;}
    }
    ---------------------------------------------------------------------

    But, of course, it didn't work . Now stOn2 was undefined! Don't know why, but it was.

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2002
    Posts
    95
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Any clues how I can fix this in IE?
    Please help


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
  •