SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Script not working on Netscape

    Hello,

    I have the following script for hiding/showing some of the content. However, this script is not working on Netscape. How can I modify this to make it work on other browsers?


    PHP Code:

    function showhide(obj){
    if (
    obj.style.display=='none'){
    obj.style.display='';
    }
    else {
    obj.style.display='none' ;



    I call this script from <span>

    PHP Code:
    <span id="questions"  class="faq" onClick="showhide(a1)"
    Are scholarships available? </span

    <
    span id="a1" style="display:none">
    <
    p>Financial aid information may be obtained by going to <p> </span
    Thank you very much,

  2. #2
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're relying on the MS-proprietary document.all DOM. Try this:

    Code:
    function showhide(name){ 
        var obj = document.getElementById(name);
         if (obj.style.display=='none'){ 
         obj.style.display=''; 
         } else { 
         obj.style.display='none' ; 
          }
    HTML Code:
    <span id="questions"  class="faq" onClick="showhide('a1')"> 
        Are scholarships available? </span> 
         
        <div id="a1" style="display:none"> 
        <p>Financial aid information may be obtained by going to <p> </div>
    Note the extra quotes in the showhide method call. I also changed the "a1" element to a div, rather than a span, as it's not valid to nest a block level element (like a paragraph) within an inline element (such as a span)

  3. #3
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you very much for your help.

    It works great! I have one more question, however. In netscape, the cursor icon does not change to "hand" on mouse over to show those are clickable. How can I do that?

  4. #4
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I forgot to say that I was using CSS to change the cursor for IE but it does not work for NS. :'( Any suggestion?

  5. #5
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try
    cursor: pointer; cursor: hand;

  6. #6
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by bilinmiyo
    thank you very much for your help.

    It works great! I have one more question, however. In netscape, the cursor icon does not change to "hand" on mouse over to show those are clickable. How can I do that?
    Well, if your SPAN should look like a link (<A>) and behave like a link, it should be a link.


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
  •