The Sea King 0 Posted November 10, 2007 Report Share Posted November 10, 2007 How do I make a javascript that makes the window have 600px of width and 400px of height? Quote Link to post Share on other sites
Ingolme 1,035 Posted November 10, 2007 Report Share Posted November 10, 2007 Just try this:W = 600;H = 400;window.resizeTo(W,H); Quote Link to post Share on other sites
The Sea King 0 Posted November 10, 2007 Author Report Share Posted November 10, 2007 It worked!Thanks. Also I need to put in these but I don't how... "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=yes, width=400, height=100" Quote Link to post Share on other sites
Ingolme 1,035 Posted November 10, 2007 Report Share Posted November 10, 2007 The toolbar can only be set before the window is opened.If you want to empty the window (I notice 'location=no') you can try:window.location.href = "about:blank";About other properties:window.personalbar = 0;window.statusbar = 0;window.menubar = 0;window.scrollbars = 0;There's no resizeable property for an existing window, but this script might be able to fix that:window.onresize = function() {return false;window.resizeTo(W,H); //W and H were defined in the script I showed you before}The window should maintain its history if you're not opening a new window. Quote Link to post Share on other sites
The Sea King 0 Posted November 10, 2007 Author Report Share Posted November 10, 2007 it didn't work... <script type="text/javascript">window.location.href = "about:window.personalbar = 0;window.statusbar = 0;window.menubar = 0;window.scrollbars = 0;";window.onresize = function() {return false;window.resizeTo(W,H);W = 600;H = 425;window.resizeTo(W,H);</script> Quote Link to post Share on other sites
Synook 47 Posted November 10, 2007 Report Share Posted November 10, 2007 <script type="text/javascript">window.location.href = "about:window.personalbar = 0;window.statusbar = 0;window.menubar = 0;window.scrollbars = 0;";window.onresize = function() {W = 600;H = 425;window.resizeTo(W,H);}</script> Quote Link to post Share on other sites
The Sea King 0 Posted November 10, 2007 Author Report Share Posted November 10, 2007 nope. didn't work. Quote Link to post Share on other sites
Ingolme 1,035 Posted November 10, 2007 Report Share Posted November 10, 2007 Maybe rather than using 0, false may be better:For example: window.menubar = falseAnd if that doesn't work try "no", but that doesn't really make much sense to me. Quote Link to post Share on other sites
justsomeguy 1,135 Posted November 12, 2007 Report Share Posted November 12, 2007 window.location.href = "about:window.personalbar = 0;window.statusbar = 0;window.menubar = 0;window.scrollbars = 0;";There's a quote on the first line that doesn't end until the last line, that should be fixed. Quote Link to post Share on other sites
Ingolme 1,035 Posted November 12, 2007 Report Share Posted November 12, 2007 That wasn't in the original code I gave. Quote Link to post Share on other sites
SpOrTsDuDe.Reese 1 Posted November 13, 2007 Report Share Posted November 13, 2007 <script type="text/javascript">window.location.href = "about:window.personalbar = 0;window.statusbar = 0;window.menubar = 0;window.scrollbars = 0;";window.onresize = function() {return false;window.resizeTo(W,H);W = 600;H = 425;window.resizeTo(W,H);</script>Do you need it to be javascript?<script type="text/javascript">window.location.href = "about:window.personalbar = 0;window.statusbar = 0;window.menubar = 0;window.scrollbars = 0;";window.onresize = function() {W = 600;H = 425;window.resizeTo(W,H);}</script> the window.location.href will change the URL, so if your making the URL different change the code to top.location.replace <script type="text/javascript">top.location.replace = "about:window.personalbar = FALSE;window.statusbar = FALSE;window.menubar = FALSE;window.scrollbars = FALSE;";window.onresize = functionRESIZE() {W = 600;H = 425;window.resizeTo(W,H);}</script> Try that code. If it doesn't work try 'NULL' instead of FALSE. If that doesn't work tell me then -.- Quote Link to post Share on other sites
Ingolme 1,035 Posted November 13, 2007 Report Share Posted November 13, 2007 Does anybody realise the problem is this?:= "about:I wrote = "about: blank" in the original code. All those who have been revising my code and know something should have been aware of this. Quote Link to post Share on other sites
jesh 0 Posted November 13, 2007 Report Share Posted November 13, 2007 Does anybody realise the problem is this?:= "about: Yeah, justsomeguy pointed that out a few posts ago.If you want to empty the window (I notice 'location=no') you can try:window.location.href = "about:blank";Another way to clear the screen, if that's what you are trying to do, is to run something like this after the page has loaded:function clearScreen(){ document.open(); document.write(""); document.close();} Quote Link to post Share on other sites
SpOrTsDuDe.Reese 1 Posted November 14, 2007 Report Share Posted November 14, 2007 Would the bodyOnLoad event be good for that? Or would you have to use elapsed time to run function clearScreen(){ document.open(); document.write(""); document.close();} ? Quote Link to post Share on other sites
justsomeguy 1,135 Posted November 14, 2007 Report Share Posted November 14, 2007 You could put it in onload. Quote Link to post Share on other sites
SpOrTsDuDe.Reese 1 Posted November 15, 2007 Report Share Posted November 15, 2007 Yea. Try that. <body onload="clearScreen()">function clearScreen(){ document.open(); document.write(""); document.close();} Try that. Quote Link to post Share on other sites
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.