ASP.NET Text Menu - How to use Javascript instead of links when clicking on items

To accomplish this, in the Url parameter of the Add method, we write something like:
"javascript:myFunction();void(0);"
Make sure you leave UrlTarget parameter null or not specified at all.

Example:
    tm1.Add("parentId", "itemId", "item text", "javascript:alert('you clicked me');void(0);", null);
When user will click on the item, an alert box will pop up.


To try it, click on IBM item in the following menu:
 
Brands>
Systems>
Hardware>
Software>

"What can I say except Oustanding! Not only was your response clear, concise and complete, it was amazingly quick. I am very impressed and will certainly recommend in future. Thank you :-) "

Pete Davies

Random testimonial   All testimonials