Jump to content

Archived

This topic is now archived and is closed to further replies.

nirvana

Two buttons Action

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
[!--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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.