Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    May 2012
    Thanked 0 Times in 0 Posts

    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 :
    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 06:31 AM.

  2. #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,947 Times in 4,908 Posts
    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.
    Be yourself. No one else is as qualified.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts