Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

In PHP JavaScript window.location.href is not working on submit button. The problem is that function order() is not going on submit button. I have tried alert(''); message also.

I want when order button submitted, then form submits and user is redirected to login.php

<script type="text/javascript">
  function order() {
    var sStr1 = "login.php";
    window.location.href = sStr1;
    return false;
  }
</script>

<input type="submit" class="button4" name="order" id="order" value="Place Order" onclick="order()" >
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
314 views
Welcome To Ask or Share your Answers For Others

1 Answer

Changing window.location does not submit a form. I'd rather type <form action="login.php" method="..."> and then Javascript is not necessary.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...