colap Posted October 6, 2009 Share Posted October 6, 2009 <script type="text/javascript" language="javascript"> function thatpage(){ document.URL="byte.html"; } </script> <form> <input name="ins" type="submit" value="INSERT" onclick="thatpage"/> <input name="upt" type="submit" value="UPDATE"/> <input name="del" type="submit" value="DELETE"/> </form> Quote Link to comment Share on other sites More sharing options...
Mchl Posted October 6, 2009 Share Posted October 6, 2009 http://catb.org/~esr/faqs/smart-questions.html Quote Link to comment Share on other sites More sharing options...
colap Posted October 6, 2009 Author Share Posted October 6, 2009 http://catb.org/~esr/faqs/smart-questions.html If i click the button it's not redirected to new page. Where would i change in my code? Where is the error? Quote Link to comment Share on other sites More sharing options...
Mchl Posted October 6, 2009 Share Posted October 6, 2009 <script type="text/javascript" language="javascript"> function thatpage(){ document.location="byte.html"; } </script> <form> <input name="ins" type="button" value="INSERT" onclick="thatpage()"/> <input name="upt" type="submit" value="UPDATE"/> <input name="del" type="submit" value="DELETE"/> </form> document.URL is readonly propery. You can't change it. HTML button type 'submit' will always try to send the form. Use type 'button' for other actions Calling JS function you have to add () to function identifier. Quote Link to comment Share on other sites More sharing options...
colap Posted October 6, 2009 Author Share Posted October 6, 2009 Why do they all work? document.location="byte.html"; document.location.href="byte.html"; window.location="byte.html"; window.location.href="byte.html"; location.href="byte.html"; Quote Link to comment Share on other sites More sharing options...
Mchl Posted October 6, 2009 Share Posted October 6, 2009 Ask people who create browsers. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.