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?
| SitePoint Sponsor |
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?
Firebird's javascript console says "Error: roll_in is not defined"
I can see two possible reasons why it might think this:
- 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
- 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: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.Code:Error: goto is a reserved identifier Source Code: javascript:goto('blog/main.php');
[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.
gav
http://www.livejournal.com/users/blufive/
browser stats analysis and comment:
http://www.livejournal.com/community/stats_weenie/
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...





No idea, though you may be interested in this thread if you think that you might be worried about it:Originally Posted by sblum
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 */You may find it useful. No JS.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>
Hello World
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.





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




<script type="text/javascript">
When i learned javascript it was opened like this:
<script language="javascript1.2">
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.Originally Posted by 4SeeN
gav
http://www.livejournal.com/users/blufive/
browser stats analysis and comment:
http://www.livejournal.com/community/stats_weenie/




so when i put <script type="text/javascript">
Do i also need to state the version such as
<script type="text/javascript1.2">





The browser won't care either way. Whatever keeps you happy. I'd use the first one.
Douglas
Hello World




Just to safeguard can i use:
<script language="javascript1.2" type="text/javascript">
or would that syntax be invalid?





Depends on your Doctype
Hello World
Bookmarks