JavaScript problems

GEC: Discuss gaming, computers and electronics and venture into the bizarre world of STGODs.

Moderator: Thanas

Post Reply
User avatar
haas mark
Official SD.Net Insomniac
Posts: 16533
Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:

JavaScript problems

Post by haas mark »

I'm having some JavaScript problems. I have this code taken exactly as was written in the book that I'm using, but the File menu doesn't seem to want to work.. is there something I'm doing wrong or not seeing?

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Playing with pulldown menus</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/javascript">
<!--

stdBrowser = (document.getElementById) ? true : false

function toggleMenu(currElem,nextPos) {
  menuObj = (stdBrowser) ? document.getElementById(currElem).style : eval("document." + currElem)
  if (toggleMenu.arguments.length == 1) {
    nextPos = (parseInt(menuObj.top) == -5) ? -90 : -5
  }
  menuObj.top = (stdBrowser) ? nextPos + "px" : nextPos
}

-->
</script>
<style type="text/css">
<!--

.menu {position:absolute; font:12px arial, helvetica, sans-serif; background-color:#CCCCCC; layer-background-color:#CCCCCC; top:-90px}
#fileMenu {left:10px; width:70px}
#searchMenu {left:85px; width:100px}
A {text-decoration:none; color:#000000}
A:hover {background-color:#000000; color:#FFFFFF}

-->
</style>
</head>

<body bgcolor="#FFFFFF">

<div id="fileMenu" class="menu" onMousover="toggleMenu('fileMenu',-5)" onMouseout="toggleMenu('fileMenu',-90)"><br>
<a href="javascript:window.open()">Open</a><br>
<a href="javascript:window.print()">Print</a><br>
<a href="javascript:history.back()">Back</a>
<a href="javascript:history.forward()">Forward</a><br>
<a href="javascript:window.close()">Close</a><hr>
<a href="javascript:toggleMenu('fileMenu')">File</a>
</div>
<div id="searchMenu" class="menu" onMouseover="toggleMenu('searchMenu',-5)" onMouseout="toggleMenu9'searchMenu',-90)"><br>
<a href="http://www.ask.com">Ask Jeeves</a><br>
<a href="http://www.google.com">Google</a><br>
<a href="http://www.alltheweb.com">All The Web</a><br>
<a href="http://www.av.com">AltaVista</a><br>
<a href="http://www.dmoz.com">Open Directory</a><hr>
<a href="javascript:toggleMenu('searchMenu')">Search</a>
</div>

</body>
</html>
~ver
Robert-Conway.com | lunar sun | TotalEnigma.net

Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]

Formerly verilon

R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005


Image
User avatar
haas mark
Official SD.Net Insomniac
Posts: 16533
Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:

Post by haas mark »

-pokes- does anyone have any ideas? I need to know for my job, and my book isn't telling me anything...

~ver
Robert-Conway.com | lunar sun | TotalEnigma.net

Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]

Formerly verilon

R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005


Image
User avatar
BoredShirtless
BANNED
Posts: 3107
Joined: 2003-02-26 10:57am
Location: Stuttgart, Germany

Post by BoredShirtless »

onMouseover, not onMousover. And burn that book you took this shit from; anybody using the shorthand version of the if condition and concatenating strings at the same time should be shot. Actually, the shorthand if is used exclusively by blow hards too lazy to give a shit about the future readability of their crap. That's the problem with most developers; they think they're Gods gift to the world, and so don't have to spend the effort to make their code as readable as possible.
User avatar
haas mark
Official SD.Net Insomniac
Posts: 16533
Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:

Post by haas mark »

BoredShirtless wrote:onMouseover, not onMousover. And burn that book you took this shit from; anybody using the shorthand version of the if condition and concatenating strings at the same time should be shot. Actually, the shorthand if is used exclusively by blow hards too lazy to give a shit about the future readability of their crap. That's the problem with most developers; they think they're Gods gift to the world, and so don't have to spend the effort to make their code as readable as possible.
Hey, I fix my code up more than that... at least the CSS part. As for JavaScript, I hardly know anything about it.

Also, does anyone know if it's possible to have a list go backward in number?

~ver
Robert-Conway.com | lunar sun | TotalEnigma.net

Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]

Formerly verilon

R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005


Image
User avatar
Pu-239
Sith Marauder
Posts: 4727
Joined: 2002-10-21 08:44am
Location: Fake Virginia

Post by Pu-239 »

Also, what do you mean by list? Array? What do you mean go backward?

Best book on Javascript/HTML/CSS is http://www.oreilly.com/catalog/dhtmlref2/

Too bad it's 60$. Fortunately it happens to be in my library system. Check yours. All other books I've seen are crap. Best website is http://www.quirksmode.org/, which has almost everything the book has on Javascript and CSS (less on HTML, but then again you can look that up at w3c.org since most browsers support a good portion of HTML 4.0(1?)).

ah.....the path to happiness is revision of dreams and not fulfillment... -SWPIGWANG
Sufficient Googling is indistinguishable from knowledge -somebody
Anything worth the cost of a missile, which can be located on the battlefield, will be shot at with missiles. If the US military is involved, then things, which are not worth the cost if a missile will also be shot at with missiles. -Sea Skimmer


George Bush makes freedom sound like a giant robot that breaks down a lot. -Darth Raptor
User avatar
haas mark
Official SD.Net Insomniac
Posts: 16533
Joined: 2002-09-11 04:29pm
Location: Wouldn't you like to know?
Contact:

Post by haas mark »

My JavaScript Book (except that it's 4th edition, not 5th).

I also have my HTML book from them. They are actually pretty good.

By lists, I mean like this:
  1. blah
  2. blah
  3. blah
By backwards, I mean going from 20-1 instead of 1-20.

Also, your second link doesn't work.

~ver
Robert-Conway.com | lunar sun | TotalEnigma.net

Hot Pants à la Zaia | BotM Lord Monkey Mod OOK!
SDNC | WG | GDC | ACPATHNTDWATGODW | GALE | ISARMA | CotK: [mew]

Formerly verilon

R.I.P. Eddie Guerrero, 09 October 1967 - 13 November 2005


Image
User avatar
Pu-239
Sith Marauder
Posts: 4727
Joined: 2002-10-21 08:44am
Location: Fake Virginia

Post by Pu-239 »

Oh, I accidently put a . after the /

Fixed link is www.quirksmode.org

ah.....the path to happiness is revision of dreams and not fulfillment... -SWPIGWANG
Sufficient Googling is indistinguishable from knowledge -somebody
Anything worth the cost of a missile, which can be located on the battlefield, will be shot at with missiles. If the US military is involved, then things, which are not worth the cost if a missile will also be shot at with missiles. -Sea Skimmer


George Bush makes freedom sound like a giant robot that breaks down a lot. -Darth Raptor
Post Reply