vmars316 Posted April 18, 2016 Share Posted April 18, 2016 Hello & Thanks , I would like to know why this doesn't work: <input type="button" onclick="window.reload(); return false;" value="click me" /> but this does: Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted April 18, 2016 Share Posted April 18, 2016 Something seems to be missing here. I don't see a reason why your first line of code would not work. What happens when you try it? Link to comment Share on other sites More sharing options...
vmars316 Posted April 18, 2016 Author Share Posted April 18, 2016 Hmm... Yes , that's interesting . this one: <input type="button" onclick="window.reload(); return false;" value="click me" /> </a> runs fine , locally , no errors . This one run locally , gives this error: <input type="button" onclick="window.reload(); return false;" value="click me" /> mozilla.org-Breakout-All-ReadOnly-vmTest01.html:18 Uncaught TypeError: window.reload is not a function Run online: they both get errors: <input type="button" onclick="window.reload(); return false;" value="click me" /> </a> mozilla.org-Breakout-All-ReadOnly-vmTest01.html:16 Uncaught TypeError: window.reload is not a functiononclick @ mozilla.org-Breakout-All-ReadOnly-vmTest01.html:16 <input type="button" onclick="window.reload(); return false;" value="click me" /> mozilla.org-Breakout-All-ReadOnly-vmTest01.html:18 Uncaught TypeError: window.reload is not a function The surrounding code looks like this: <body> <canvas id="myCanvas" width="480" height="320"></canvas> <div <div style="background-color:#eeeeee; width:480px; margin:0 auto;"> <img id="flaming" src="./sprites/fireTransparent.gif" width="480" height="42" /> <input type="button" onclick="window.reload(); return false;" value="click me" /> </a> <input type="button" onclick="window.reload(); return false;" value="click me" /> </div> <script> I can Post the whole code if you like , its 196 lines . You can run it here: http://liesandcowpies.com/javascript/mozilla.org-Breakout-All-ReadOnly-vmTest01.html It's the breakout game , with a few additions . Thanks Link to comment Share on other sites More sharing options...
Ingolme Posted April 18, 2016 Share Posted April 18, 2016 Wait, there's no reload() method on the window. You must be thinking of location.reload() Link to comment Share on other sites More sharing options...
vmars316 Posted April 18, 2016 Author Share Posted April 18, 2016 Awesome , now they both work , locally and online . THANKS Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now