Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-10-2012, 04:42 AM   PM User | #1
xaverian
New Coder

 
Join Date: May 2012
Posts: 46
Thanks: 3
Thanked 0 Times in 0 Posts
xaverian is an unknown quantity at this point
document.pressed not working in Internet Explorer

Hi ,

I have 'document.pressed ' checking in my javascript code. Problem is it is working fine in Firefox but not in Internet Explorer. I need to make it work in both the browser.

My code is as follows :
Code:
function onSubmitForm()
{
if(document.pressed == 'Save')
{
  redirect to  url1
}
if(document.pressed == 'Run')
{
 redirect to url2
}
}
<input type="submit" value = 'Save'  name='SaVE_RUn'
	onclick = "document.pressed=this.value">
<input type="submit" value = 'Run'  name='RUn'
	onclick = "document.pressed=this.value">
Please help, Thanks.

Last edited by xaverian; 10-10-2012 at 05:31 AM..
xaverian is offline   Reply With Quote
Old 10-10-2012, 07:51 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,248
Thanks: 59
Thanked 3,999 Times in 3,968 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
There is no such thing as document.pressed. If FF allows it, you are just lucky.

In any case, there is a *MUCH* easier way to do this.
Code:
<input type="submit" value = 'Save'  name='does_not_matter'
	onclick = "this.form.action='url1'; return true;" />
<input type="submit" value = 'Run'  name='who_cares'
	onclick = "this.form.action='url2'; return true;" />
Presto. Done.

No need for the onSubmitForm function any more.

Replace url1 and url2 with the actual URLs you need, of course.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:03 PM.


Advertisement
Log in to turn off these ads.