...

View Full Version : document.pressed not working in Internet Explorer



xaverian
10-10-2012, 04:42 AM
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 :


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.

Old Pedant
10-10-2012, 07:51 AM
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.


<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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum