Making a cross browser DHMTL menu (mainly concerned about DOM)
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Making a cross browser DHMTL menu (mainly concerned about DOM)
Mozilla has moved to the DOM, which I think is kind of like a new JavaScript version. It's not backwards compatable with the old version so the document.layers vs document.all test doesn't work any more.
I've tried and tried to write my own or get a script from somewhere else, but I can't seem to be able to come up with anything. Being a programmer, I'd really like to understand the JavaScript on my site. Does anybody know where I can learn about the DOM and the lates cross-browser JavaScript?
Mozilla's DOM docs have been a little helpful, but there aren't any examples.
If you're still having trouble, post some code that you think should work, but doesn't, and we'll probably be able to help you. Also, mozilla includes a Javascript debugger and DOM viewer, which is pretty nice to have when you're learning the structure.
One final tip: To seach for Javascript working in in 2000+, search for "getElementById".
Hmmm... Ok, I've got some code that doesn't work. Help me debug this:
alert("hi");
Yes, "alert" doesn't even work. I know it should because it's on the Mozilla site (http://www.mozilla.org/docs/dom/domr...8.html#1028465).
I know I've got JavaSript turned on. What's the matter? Why is this so hard?
Originally posted by Travis86 Hmmm... Ok, I've got some code that doesn't work. Help me debug this:
alert("hi");
Yes, "alert" doesn't even work. I know it should because it's on the Mozilla site (http://www.mozilla.org/docs/dom/domr...8.html#1028465).
I know I've got JavaSript turned on. What's the matter? Why is this so hard?
Well, it works for me... so something other than the alert is wrong. Try copy&paste the following document into an html-file and then load it in a browser. I've tried both Konqueror and Mozilla, and it works in my end...
Quote:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test</title>
<meta name="author" content="Esben Mose Hansen">
<script type="text/javascript">
alert("hi");
</script>
</head>
<body>
<p>An example</p>
</body>
</html>
Ok, I don't really understand this, but I can get my code to work when I take language="JavaSript" out of the <script> tag. Are we still using JavaScript, or has the name changed?
I'm not sure why your language attribute doesn't work, but anyhow, that attribute is deprecated. Use type instead; or use a META tag as described here:
language = cdata [CI]
Deprecated. This attribute specifies the scripting language of the contents of this element. Its value is an identifier for the language, but since these identifiers are not standard, this attribute has been deprecated in favor of
PS: I assume your 'language="JavaSript"' included one more 'c'
Hmmmm... Hopefully "sript" was a typo in my post only. I'll try to remember that "language" is depreciated.
Anyway, I've got something going (sort of) now. Unfortunately, the screen goes blank when it should display a menu. I had this problem once with a pop-up window, which was returning "true" and getting rid of everything else. I don't think these functions are returning anything. I tried void(), but that didn't work.
I can't reach the above URLs, and anyway, I don't won't to debug an entire application. Can't you try to cut away bits, print to some debug window or whatever until you've have isolated no more than 50 problematic lines? You may even solve the problem yourself this way )
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.