Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed to alter a javascript dropdown menu

Status
Not open for further replies.

FvS

Programmer
Apr 5, 2006
20
NL
Hi all

I've downloaded a dropdown-menu from
Could somebody please help me to solve one thing?
I need to use the menu in the following why:
[MENU BUTTON] [DESCRIPTION]

On the mouseover-event of the [MENU BUTTON] it must show the menu and when you select something it should fill the [DESCRIPTION] field, but the following effect accourse, between the button and description field, space is reserved to show the submenu. It would be great if i could change the script so, that instead of openening the first menu to the right of the [MENU BUTTON] it opens below the [MENU BUTTON].

Could somebody please help me solve this problem i'am still a beginner and it would cost me days to solve this.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en">
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="classic.css" />
<script language="javascript" src="jsdomenu.js"></script>
<script type="text/javascript" src="mousepos.js"></script>

<SCRIPT type="text/javascript">
<!--
  function createjsDOMenu() {
  cursorMenuBar = new jsDOMenu(100, "static", "MenuBar");
  with (cursorMenuBar) {
    addMenuItem(new menuItem("Select" , "Main", ""));
    show();
   }

cursorMenuMain = new jsDOMenu(165);
  with (cursorMenuMain) {
    addMenuItem(new menuItem("Option1","H0000000",""))
  }

cursorMenuM0000000= new jsDOMenu(165);
  with (cursorMenuM0000000) {
    addMenuItem(new menuItem("Option1a", "","code:alert('hello world')"))
    addMenuItem(new menuItem("Option1b", "","code:alert('hello world')"))
  }

cursorMenuBar.items.Main.setSubMenu(cursorMenuMain);
cursorMenuMain.items.H0000000.setSubMenu(cursorMenuM0000000)
-->
</SCRIPT>
</HEAD>

<BODY  bgcolor="A0D9D9" onload="initjsDOMenu()" ID="Bdy" bgColor=white >

<table border=0 cellpadding=0 cellspacing=0 width=100% align="center">
<tr >
  <td width="30%" class="prompt"> Choose categorie</td>
  <td><DIV Id="MenuBar" width="100"></DIV></td>
  <td><input maxlength=0 name=omschrijving size=30></td>
</tr>
</table>
</BODY>
</HTML>

I've downloaded the following dropdown menu:
 
I'll make a deal with you... you get your code to validate against the doctype, and I'll look at the script. As it stands... your code sample is woefully bugged.

Maybe you'd be better off emailing the original author of the code you got from Dynamic Drive and asking them for support?

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Hi Dan and Jeff,

I've already emailed the original author of the script but I don't think he is going to answer me.

The sample code is just a sample but i hope this is better.

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="classic.css" />
<script language="javascript" src="jsdomenu.js"></script>
<script type="text/javascript" src="mousepos.js"></script>

<script type="text/javascript">
<!--
function createjsDOMenu() {
  cursorMenuBar = new jsDOMenu(100, "static", "MenuBar");
    with (cursorMenuBar) {
    addMenuItem(new menuItem("Select" , "Main", ""));
    show();
  }

  cursorMenuMain = new jsDOMenu(165);
    with (cursorMenuMain) {
    addMenuItem( new menuItem("Option1","H0000000","") );
  }

  cursorMenuM0000000= new jsDOMenu(165);
    with (cursorMenuM0000000) {
    addMenuItem( new menuItem("Option1a", "","code:alert('hello world')"));
    addMenuItem( new menuItem("Option1b", "","code:alert('hello world')"));
  }

  cursorMenuBar.items.Main.setSubMenu(cursorMenuMain);
  cursorMenuMain.items.H0000000.setSubMenu(cursorMenuM0000000);
}
-->
</script>
</head>

<body bgcolor="A0D9D9" onload="initjsDOMenu()" id="Bdy" bgcolor="white" >

<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center">
<tr >
  <td width="30%" class="prompt">Choose categorie</td>
  <td><div id="MenuBar" width="100"></div></td>
  <td><input maxlength="0" name="omschrijving" size="30"></td>
</tr>
</table>

</body>
</html>
 
Is there really no one who could help me?!
The original author doesn't respond to e-mails.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top