shiny_spoon Posted October 11, 2006 Share Posted October 11, 2006 Is it possible to change the action="" property of a form on the fly using JavaScript?Basically something similar to:[code]onmouseover="this.classname='css'"[/code]...but for action! :PThanks! Link to comment https://forums.phpfreaks.com/topic/23661-change-form-action-on-the-fly/ Share on other sites More sharing options...
wildteen88 Posted October 11, 2006 Share Posted October 11, 2006 Yes. Give your form a name by adding the name="my_form_name" attribute to the form tag then use use the following javascript:document.my_form_name.action='new action here' Link to comment https://forums.phpfreaks.com/topic/23661-change-form-action-on-the-fly/#findComment-107416 Share on other sites More sharing options...
obsidian Posted October 11, 2006 Share Posted October 11, 2006 or, if you want to use a mouseover function like you're referencing, you can attach this to the element within the form:[code]onmouseover="this.form.action='post';"[/code] Link to comment https://forums.phpfreaks.com/topic/23661-change-form-action-on-the-fly/#findComment-107421 Share on other sites More sharing options...
shiny_spoon Posted October 11, 2006 Author Share Posted October 11, 2006 Thank you both very much! ;D Link to comment https://forums.phpfreaks.com/topic/23661-change-form-action-on-the-fly/#findComment-107428 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.