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

I have one form data.php with following form structure.

 <div id="form-container" style="padding-top: 10px; padding-bottom: 10px;">

  var x=Math.random();;
  if(x > 0.5)
  {
      submit form
  } 


 <p style="width: 100%; text-align: right;"><button type="button" id="submit-button">Sumit</button></p>

How form can be automatically submitted based on x value? Which means button should be pressed automatically.

See Question&Answers more detail:os

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

1 Answer

document.getElementById('theForm').submit();


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