SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Guru quenting's Avatar
    Join Date
    Dec 2002
    Location
    Switzerland
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic status bar

    hi,
    hi have some links that open javascript functions in their href field. I don't like seeing "javascript:whatever()" in the status bar, so i'm willing to use something like :
    Code:
    <a href="javascript:whatever();" 
    onmouseover="self.status='something';return true;" onmouseout="self.status='';">The link text</a>
    The thing is, i'd like the 'something' to be the text contained within the link itself (here, "The link text"), and to be retrieved dynamically (i don't want to write self.status='The link text').
    Is there some way i could do that ? what should i set the self.status to ?
    Also, is there some way i can make this work on netscape ?

    Thanks,
    Quentin

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    onmouseover="window.status=this.innerHTML;return true;"

    Works in NS7, but I think you mean NS4 when you say "...make this work on netscape"?

  3. #3
    SitePoint Guru quenting's Avatar
    Join Date
    Dec 2002
    Location
    Switzerland
    Posts
    735
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well i'm testing under NS6 and the window.status doesn't seem to do anything.
    What i'm thinking is that if there's not way this works within netscape, it allows me to use IE-only 'behavior' feature to set all status bar mouseover/out events.

    Quentin

  4. #4
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The strange thing is that if you try
    onmouseover="alert(this.innerHTML);"
    ...you see that the innerHTML property works in Netscape (6.2)

    Why isn't window.status working

  5. #5
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Someone here told me a while back that it was better to use .text instead of .innerHTML but I can't remember if that was more successful or not.


    Andy
    From the English nation to a US location.

  6. #6
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Originally posted by awestmoreland
    Someone here told me a while back that it was better to use .text instead of .innerHTML but I can't remember if that was more successful or not.


    Andy
    innerHTML is supposedly not a standard method, but MS and Netscape implemented it anyway. That may be why you were told that .text was better; it may be the standard.

  7. #7
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's entirely possible that it will work in N6.2 but not N6.0 - there was quite a lot of development between those two browsers.

    Bear in mind, however, that many mozilla-based browsers (possibly including one or both of these) allow the user to prevent javascript messing with the status bar (a lesser-known cousin of the pop-up blocking)

  8. #8
    The doctor is in... silver trophy MarcusJT's Avatar
    Join Date
    Jan 2002
    Location
    London
    Posts
    3,509
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by vgarcia

    innerHTML is supposedly not a standard method, but MS and Netscape implemented it anyway. That may be why you were told that .text was better; it may be the standard.
    Actually, I would have thought that it would be because if there was HTML inside the <a> tag like this:
    Code:
    <a href="javascript:whatever();" 
    onmouseover="status=this.innerHTML;return true;" onmouseout="status='';">This is <b>great!</b></a>
    then the status bar would display:
    Code:
    This is <b>great!</b>
    whereas using .innerText would give you only the text (no tags) like this:
    Code:
    This is great!
    MarcusJT
    - former ASP web developer / former SPF "ASP Guru"
    - *very* old blog with some useful ASP code

    - Please think, Google, and search these forums before posting!


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
  •