Javascript being naughty
-
<script type="text/javascript"> function redirect_to(){ var pathname = window.location.host; var s = document.getElementById('redirect_s').value; if(s == "") { alert('Please Enter the number in textbox'); } else{ location.replace( "/" + s) ; } } </script> <form method="post" action=""> <label class="assistive-text" for="s">Search</label> <input id="redirect_s" class="field" type="text" placeholder="Jump to image #" name="redirect_s"> <input id="searchsubmit" class="submit" type="button" onclick="redirect_to();" value="Search" name="submit"> </form>
This bit of code should be directing users to onceuponasidewalk.com/whatevertheyenteredintextbox, but it has decided to instead direct them back to whatever page they started on.
Any ideas what’s going wrong here?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Javascript being naughty’ is closed to new replies.