Hi All,
i am a begineer in javascript, basically a J2EE developer
so please don't mind if my question is out of track or a funny one
i am using the menu from the milonic team, it is being displayed in perfect manner, now i want that if the user click on any menu item or sub-meny item, i want to call a javascript function on the ONclick event and from there want to submitt the page.
for example in the usual manner
with(milonic=new menuname("About Us")){
style=submenuStyle;
aI("text=Product Purchasing Page;url=http://www.milonic.com/contactus.php;");
}
when the user click on the item "Product Purchasing Page" it will show up the http://www.milonic.com/contactus.php page
but i want that instaed of showing the page when the user click on the text with title "Product Purchasing Page" an onclick function will get called
so that i can set the action in the form nd submit the form
pleasetell me or suggest me how can i achieve that
thanks in advance
-umesh
Calling Javascript Function [solved]
-
- Beginner
- Posts: 3
- Joined: Sat Jul 05, 2008 5:58 pm
Re: Calling Javascript Function
Hi,
I'm not sure I understand what you want. Are you saying that when a person opens a submenu if they click on an item nothing happens for them but a form gets submitted to you? Wouldn't they wonder why they didn't go to any kind of page or something? Or do you want it to go to the page but also submit some kind of form to you?
You can set up the menu to submit things onclick. First you'd need a function for submitting. Then in your aI string you'd set up a clickfunction= and call that submit function. Something like this
So, on click the menu would look for the submit_me function and do whatever that function is
Here is a post about using a submit function
viewtopic.php?f=10&t=9221&hilit=submit#p43770
Ruth
I'm not sure I understand what you want. Are you saying that when a person opens a submenu if they click on an item nothing happens for them but a form gets submitted to you? Wouldn't they wonder why they didn't go to any kind of page or something? Or do you want it to go to the page but also submit some kind of form to you?
You can set up the menu to submit things onclick. First you'd need a function for submitting. Then in your aI string you'd set up a clickfunction= and call that submit function. Something like this
Code: Select all
aI("text=Submit Me!;clickfunction=submit_me()");
Here is a post about using a submit function
viewtopic.php?f=10&t=9221&hilit=submit#p43770
Ruth
-
- Beginner
- Posts: 3
- Joined: Sat Jul 05, 2008 5:58 pm
Re: Calling Javascript Function
Thanks Ruth for the quick reply
i did what u mentioed in the post, actually my problem is that i have to use MVC2 model(Using Struts2) for the application so i can not take the user directly to anotherpage.
so what i have to do is that if the user click any option on the main menu or sub menu i have to call an appropriate action which will decide what page the user must be taken, thats why i was interested in onclick function so that i can setr the action from the onclick event and submitt the form to the appropriate action.
Regards
umesh
i did what u mentioed in the post, actually my problem is that i have to use MVC2 model(Using Struts2) for the application so i can not take the user directly to anotherpage.
so what i have to do is that if the user click any option on the main menu or sub menu i have to call an appropriate action which will decide what page the user must be taken, thats why i was interested in onclick function so that i can setr the action from the onclick event and submitt the form to the appropriate action.
Regards
umesh
Re: Calling Javascript Function
Hi,
So did that information allow you to do what you need?
Ruth
So did that information allow you to do what you need?
Ruth
-
- Beginner
- Posts: 3
- Joined: Sat Jul 05, 2008 5:58 pm
Re: Calling Javascript Function
yea it helped me to do what i was trying to do
thanks for the tip
![Smile :)](./images/smilies/icon_smile.gif)
thanks for the tip
![Smile :)](./images/smilies/icon_smile.gif)
Re: Calling Javascript Function
You're very welcome. We aim to please
Ruth
![Very Happy :D](./images/smilies/icon_biggrin.gif)
Ruth