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

Categories

0 votes
310 views
in Technique[技术] by (71.8m points)

in php javascript window.location.href not working on submit button?

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

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

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...