LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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


Reply
  Search this Thread
Old 08-14-2003, 10:44 PM   #1
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Rep: Reputation: 31
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.
 
Old 08-15-2003, 11:52 AM   #2
esben
Member
 
Registered: Jun 2003
Location: Copenhagen, Denmark
Distribution: Gentoo
Posts: 48

Rep: Reputation: 15
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!
 
Old 08-15-2003, 03:19 PM   #3
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Original Poster
Rep: Reputation: 31
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?
 
Old 08-15-2003, 05:30 PM   #4
esben
Member
 
Registered: Jun 2003
Location: Copenhagen, Denmark
Distribution: Gentoo
Posts: 48

Rep: Reputation: 15
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>
 
Old 08-15-2003, 08:39 PM   #5
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Original Poster
Rep: Reputation: 31
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?
 
Old 08-16-2003, 03:30 AM   #6
esben
Member
 
Registered: Jun 2003
Location: Copenhagen, Denmark
Distribution: Gentoo
Posts: 48

Rep: Reputation: 15
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'
 
Old 08-16-2003, 11:42 AM   #7
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Original Poster
Rep: Reputation: 31
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.
 
Old 08-16-2003, 12:07 PM   #8
esben
Member
 
Registered: Jun 2003
Location: Copenhagen, Denmark
Distribution: Gentoo
Posts: 48

Rep: Reputation: 15
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 )
 
Old 08-18-2003, 03:35 PM   #9
Travis86
Member
 
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Original Poster
Rep: Reputation: 31
"open" must be a reserved function name. After I fixed that and a few other things, it works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox Problems Can't see on my browser menu Maximuzz Linux - Software 1 09-07-2005 09:33 PM
Making Firefox my default Browser? carlosinfl Fedora 39 05-10-2005 11:02 AM
Making Menu in Wmaker hexx Linux - Newbie 10 08-20-2003 08:03 PM
Making GRUB menu Squick Linux - Newbie 1 08-08-2003 10:35 PM
Making Mozilla deafult browser from Evolution jairas01 Linux - Software 0 07-02-2003 05:46 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration