nirvana Posted March 9, 2006 Share Posted March 9, 2006 Hi All,Please see the codes I've written in the HTML form with two submit buttons.It works fine in IE but the buttons don't work in Firefox browser. Whichever button I press, it just calls up "Query.php" in Firefox.Any idea why it happens? I am new to Javascript and any input is much appreciated.<input name="display" type="submit" id="Submit" value="Screen Display" onClick="chkAction('1')"> <input name="excel" type="submit" id="Submit" value="Save to EXCEL" onClick="chkAction('2')"><script language="javascript"> function chkAction(val){ if (val=="1"){ document.form1.action="Query.php"; } else{ document.form1.action="autosave.php"; }thanks,Nirvana Quote Link to comment https://forums.phpfreaks.com/topic/4498-two-buttons-action/ Share on other sites More sharing options...
fooDigi Posted March 10, 2006 Share Posted March 10, 2006 the function may be parsing the passed values literally, meaning that it will return true no matter what you pass it. try not to use the quotes when you are using numeric data types. Quote Link to comment https://forums.phpfreaks.com/topic/4498-two-buttons-action/#findComment-16066 Share on other sites More sharing options...
nirvana Posted March 15, 2006 Author Share Posted March 15, 2006 [!--quoteo(post=353550:date=Mar 10 2006, 04:08 AM:name=fooDigi)--][div class=\'quotetop\']QUOTE(fooDigi @ Mar 10 2006, 04:08 AM) [snapback]353550[/snapback][/div][div class=\'quotemain\'][!--quotec--]the function may be parsing the passed values literally, meaning that it will return true no matter what you pass it. try not to use the quotes when you are using numeric data types.[/quote]Thanks. I did try as follows and removed all the quotes. Hope that's what you suggested.No matter what i changed, it still works in Internet Explorer.But still it doesn't work in FireFox.Anymore suggestion please??<input name="display" type="submit" id="Submit" value="Screen Display" onClick="chkAction(1)"><input name="excel" type="submit" id="Submit" value="Save to EXCEL" onClick="chkAction(2)"><script language="javascript">function chkAction(val){if (val==1){document.form1.action="Query.php";}else{document.form1.action="autosave.php";}thanks,Nirvana Quote Link to comment https://forums.phpfreaks.com/topic/4498-two-buttons-action/#findComment-17653 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.