Hello and welcome to our community! Is this your first visit?
Register
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
    Posts
    47
    Thanks
    3
    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 :
    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.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,436
    Thanks
    75
    Thanked 4,372 Times in 4,337 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.
    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.


  •  

    Posting Permissions

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