Jump to content


Photo

Two buttons Action


  • Please log in to reply
2 replies to this topic

#1 nirvana

nirvana
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 09 March 2006 - 03:19 AM

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

#2 fooDigi

fooDigi
  • Members
  • PipPipPip
  • Advanced Member
  • 250 posts
  • LocationDuluth, Mn

Posted 10 March 2006 - 09:08 AM

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.
All your base are belong to us.

#3 nirvana

nirvana
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 15 March 2006 - 02:23 AM

[!--quoteo(post=353550:date=Mar 10 2006, 04:08 AM:name=fooDigi)--][div class=\'quotetop\']QUOTE(fooDigi @ Mar 10 2006, 04:08 AM) View Post[/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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users