SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Long Beach
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Rollovers not working in Firebird?

    http://www.sblum.net

    The navbar on the left - the links are supposed to be rollovers. It works fine in IE and Opera, but not in Firebird. Any ideas why?

  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)
    Firebird's javascript console says "Error: roll_in is not defined"

    I can see two possible reasons why it might think this:
    1. The <script> element is not in the <head> OR the <body> therefore it's invalid, and it's possible that moz's parser is discarding it for that reason
    2. You haven't declared the type of script. For example, <script type="text/javascript">


    While we're at it, your reliance on the onclick attribute on paragraphs means that the navbar is completely unusable for anyone with javascript turned off. I also suspect it'll block any search engines attempting to spider the page (assuming they make it past the frameset)

    Later edit:
    There's another error message, too:
    Code:
    Error: goto is a reserved identifier
    Source Code:
    javascript:goto('blog/main.php');
    You can't give a function or variable a name which matches one of the "reserved" words in the javascript language. "goto" is one of these reserved words. You'll have to rename the function to something else.

    [thinks] actually, this could be a third possible reason why moz doesn't like your script.

    Even later edit:
    Using moz's DOM inspector, Moz's parser has picked up the script element, identified is as javascript, and included it in the <head> for you. Isn't it a nice parser? At which point, I reckon it's probably the function named "goto" that's killing it.
    Last edited by blufive; Oct 5, 2003 at 17:09.

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Long Beach
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see! Thanks very much for the tip - it works beautifully now. About the reliance on "onclick" - is this a major problem? Do a lot of people disable javascript? I'd like to not have to add <a> tags to make the code more cluttered than it is - but if it's worth it...

  4. #4
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sblum
    Do a lot of people disable javascript?
    No idea, though you may be interested in this thread if you think that you might be worried about it:

    http://www.sitepointforums.com/showt...hreadid=130905

    This is a snip from a site I am working on:

    Code:
    #btn-01 { background-image: url(images/btn_01_h.gif); }
    #btn-02 { background-image: url(images/btn_02_h.gif); }
    
    /* Rollover code */
    .rollover { display: block; } /* Allow setting widths and heights */
    .rollover img { border: 0; } /* only set width and height once */
    .rollover:hover { visibility: visible; /* for IE */ } /* sets any property for the :hover state */
    .rollover:hover img { visibility: hidden; } /* 'rolls over' the image */
    HTML Code:
      <li id="btn-01"><a href="#" title="Home"  class="rollover"><img src="images/btn_01.gif" width="66" height="24" alt="Home"   /></a></li>
      <li id="btn-02"><a href="#" title="Links" class="rollover"><img src="images/btn_02.gif" width="67" height="24" alt="Links"  /></a></li>
    You may find it useful. No JS.
    Hello World

  5. #5
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    Long Beach
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmmm... There's only one issue... It's that my rollovers aren't images, it's just the background changing colors and the text bolding. I'd rather not have to include more images in my site to make it longer to load. I think I'll just leave it how it is and maybe add some <a> tags for the rare person who has javascript disabled. Anyways - thanks both of you for your help. I appreciate it.

  6. #6
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh, then it is very simple with CSS:

    http://www.meyerweb.com/eric/css/link-specificity.html

    Only two lines of code for your effect

    Douglas
    Hello World

  7. #7
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <script type="text/javascript">


    When i learned javascript it was opened like this:

    <script language="javascript1.2">

    did it change?

  8. #8
    SitePoint Guru bronze trophy blufive's Avatar
    Join Date
    Mar 2002
    Location
    Manchester, UK
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 4SeeN
    did it change?
    Yes. The <script> element in HTML 3.2 seems to have been a placeholder only, and had no attributes. Sometime between HTML 3.2 and HTML 4.0, the language attribute was introduced (presumably by one of the competitors in the browser wars), and then deprecated in favour of type.

  9. #9
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    so when i put <script type="text/javascript">


    Do i also need to state the version such as

    <script type="text/javascript1.2">

  10. #10
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The browser won't care either way. Whatever keeps you happy. I'd use the first one.

    Douglas
    Hello World

  11. #11
    SitePoint Guru
    Join Date
    Nov 2001
    Location
    Fort Lauderdale
    Posts
    814
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just to safeguard can i use:

    <script language="javascript1.2" type="text/javascript">

    or would that syntax be invalid?

  12. #12
    SitePoint Wizard DougBTX's Avatar
    Join Date
    Nov 2001
    Location
    Bath, UK
    Posts
    2,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Depends on your Doctype
    Hello World


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
  •