Jump to content

tommyt

Members
  • Posts

    5
  • Joined

  • Last visited

tommyt's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. The return onsubmit did the trick. Thanks guys. It's bee frustrating but you helped tremendously
  2. Okay, here is what I have: <script type="text/javascript"> function gotoProductWebPage() { var answer = document.getElementById("answer").value; if (answer == 8) { window.location.href = "myurl"; return true; } else { alert("Check your Math"); return false; } } </script>​called from<form method="get" name="ProveHuman" onsubmit="gotoProductWebPage()">​ html<p style='color:blue;text-align:center' > Enter answer to prove you are human.A = 3, B = 5, A + B = <input type="number" id="answer" name="answer" /> <br /> </p> <p style="text-align: center;" > <input type = "submit" name = "Submit" value = "Submit" /></p>​ Thanks for looking. ​
  3. I tried that in the function and it did nothing. Could my syntax be wrong. window.location.href then what ... My url is of format (http://mywebsite.com/pid="0000") where I must pass the string after the / Syntax correction may be the answer...Thanks in advance.
  4. Thanks for answering, but still get same result. Url opens in a new window. Could this be a setting in IE that is overriding code?
  5. Hello, I am relatively new to javascript although I have used some over recent years in my html web pages. I have a specific problem in which I have a form with an input box that I must validate as true or false. This part works. The call to another javascript will only work if tagged as target="_blank". I want to open the new url in the same window and nothing I have found on internet has worked. Here is my code: <script type="text/javascript"> function gotoProductWebPage() { var answer = document.getElementById("answer").value; if(answer==8){ nowbaby(); return true; } else { alert("Check your Math"); return false; } } </script> <Script type="text/javascript"> function nowbaby() { window.open ("myurl,"_self",false); }​ and here is the call from form: <form method="get" name="myname" onsubmit="gotoProductWebPage()">​ and here is html snippet: <p style='color:blue;text-align:center' > Enter answer to prove you are human. A=3, B=5, A+B=<input type="number" id="answer" size="6" name="answer" /><br /> </p> <p align='center' > <input type="submit" name="Submit" value="Submit" /> </p>​ Like I said, if I make it _blank it will open in new window, but for the life of me, I cannot get it open in same window. I have tried: window.location.href = "myurl" window.open("myurl/pid='0000","_self") location.ref and nothing seems to work. I am stumped. Please Help. I am working in IE and Edge, sorry should have referenced that.
×
×
  • Create New...