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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event occurs when clicking on menu item

Status
Not open for further replies.

bill1one

Programmer
Sep 29, 2004
93
0
0
US
I would like a certain event to occur when a user clicks on "Purchase Request" in the menu.

Following is the script that generates the menu. "Purchase Request" is the second item in the menu.


window.menu_0 = new Menu("root",130,16,"Arial, Helvetica, sans-serif",10,"#002200","#002200","#D7DFD7","#F0EDE3","left","middle",3,0,250,-5,7,true,true,true,0,true,true);
menu_0.addMenuItem("Library Catalog","location='../OPAC'");
menu_0.addMenuItem("Purchase Request","location='../request.html'");

menu_0.hideOnMouseOut=true;
menu_0.menuBorder=0;
menu_0.menuLiteBgColor='#002200';
menu_0.menuBorderBgColor='#999999';
menu_0.bgColor='#cccccc';
 
And where is the rest of the code? We have absolutely no idea about:

- What menu system you are using
- What the "Menu" object is
- What the "addMenuItem" method of the "Menu" object does
- Where or how you are calling this code
- The exact error you are getting
- What steps you have taken to debug this issue yourself
- What browser(s) it fails in (IE? Firefox? For which OS?)

You really should be a bit more specific if you need help. You should also post your code between TGML [ignore]
Code:
[/ignore] tags - it makes it a whole lot easir to read.

Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Bill...

You've been a member of TT for long enough now that you should know this is not a "request some feature" kind of place. This is a place where we assist other professionals with specific problems they have encountered. You appear to have done no work on attempting to solve this yourself - and seem complacent just asking others to do your code for you.

Jeff

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

What is Javascript? FAQ216-6094
 
That looks like Front Page canned Javascript, maybe Dreamweaver, though (gack).

Lee
 
It is a dreamweaver menu, but anyhow, what I was trying to do was use an OnClick event that when a user clicked "purchase request" on the drop down menu, the following code would execute:
Code:
function requestItem() {
var is_sure=window.confirm("Click \"OK\" to confirm that you have searched the \n collection and would like to complete a request for purchase.");
 if (is_sure==true) {
 window.location="../request.html";
 } else {
 window.location="../OPAC";
 }
}
I can get it to work with a static link, but not when I use the "purchase request" item in the dropdown menu.

I'm not looking for anyone to write code for me, I just was hoping that someone had some sort of reference to help me out.
 
bill1one said:
I'm not looking for anyone to write code for me, I just was hoping that someone had some sort of reference to help me out.
Bill... take a peek back at your original post - you certainly came across that way to me.

Cheers,
Jeff

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

What is Javascript? FAQ216-6094
 
Thanks to everyone who responded. The easiest solution was to execute the code with the OnLoad event, so I didn't even use the menu in the end. I'm sorry if I caused any headaches.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top