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

Call function from menu item

Status
Not open for further replies.

saw15

Technical User
Jan 24, 2001
468
US
I am new to JS and trying to use a menu item to call a function... i.e.

This is what I want:
var menu1=new Array()
menu1[0]='<a href=update('logon')>Logon</a>'

This is what it was:
var menu1=new Array()
menu1[0]='<a href="
Any help is appreciated,
 
There are 2 ways to call a function with an anchor tag. One in on the onclick, the other is with the href.

Assuming you have a function named update, you can do this (with your example)

Code:
menu1[0]='<a href="javascript:update(\"logon\")">Logon</a>';
OR
Code:
menu1[0]='<a href="#" onclick="update(\"logon\"); return false'">Logon</a>';

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top