Window.location after an other script runned

Discussion in 'JavaScript' started by netdown, May 23, 2012.

  1. #1
    Hi!
    In an onclick event how can i do that window location only runs after the submit?
    Here's my code:
    onclick='javascript:document.forms[\"form\"].submit();window.location=document.location.href + \"more\"'
     
    netdown, May 23, 2012 IP
  2. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #2
    You might be able to do it if you set the 'target' attribute of the <form> tag to '_blank' or the name of an <iframe> embedded in the page. That way, the current page stays loaded in the browser. But, otherwise, when JavaScript executes form.submit(), the user is sent to the 'action' page and your script stops running.
     
    rainborick, May 23, 2012 IP