Programming This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
08-14-2003, 10:44 PM
|
#1
|
Member
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399
Rep:
|
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.
Thanks.
|
|
|
08-15-2003, 11:52 AM
|
#2
|
Member
Registered: Jun 2003
Location: Copenhagen, Denmark
Distribution: Gentoo
Posts: 48
Rep:
|
For a bit of fun: Here's a menu without javascript :
http://www.meyerweb.com/eric/css/edge/menus/demo.html
Otherwise, the DOM from a java-script point-of-view is described (as ECMA-script bindings) on
http://www.w3.org/TR/2000/WD-DOM-Lev...e-binding.html
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".
Have fun!
|
|
|
08-15-2003, 03:19 PM
|
#3
|
Member
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399
Original Poster
Rep:
|
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?
|
|
|
08-15-2003, 05:30 PM
|
#4
|
Member
Registered: Jun 2003
Location: Copenhagen, Denmark
Distribution: Gentoo
Posts: 48
Rep:
|
Quote:
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>
|
|
|
|
08-15-2003, 08:39 PM
|
#5
|
Member
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399
Original Poster
Rep:
|
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?
|
|
|
08-16-2003, 03:30 AM
|
#6
|
Member
Registered: Jun 2003
Location: Copenhagen, Denmark
Distribution: Gentoo
Posts: 48
Rep:
|
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:
http://www.w3.org/TR/html4/interact/scripts.html
To quote:
Quote:
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'
|
|
|
08-16-2003, 11:42 AM
|
#7
|
Member
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399
Original Poster
Rep:
|
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.
http://www.travisdart.com/home3/
and the external script file is at
http://www.travisdart.com/home3/menu.js
The onmouseover and onmouseout parts call the functions.
Thanks.
|
|
|
08-16-2003, 12:07 PM
|
#8
|
Member
Registered: Jun 2003
Location: Copenhagen, Denmark
Distribution: Gentoo
Posts: 48
Rep:
|
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 )
|
|
|
08-18-2003, 03:35 PM
|
#9
|
Member
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399
Original Poster
Rep:
|
"open" must be a reserved function name. After I fixed that and a few other things, it works.
|
|
|
All times are GMT -5. The time now is 11:15 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|