The Sea King Posted November 10, 2007 Share Posted November 10, 2007 How do I make a javascript that makes the window have 600px of width and 400px of height? Link to comment Share on other sites More sharing options...
Ingolme Posted November 10, 2007 Share Posted November 10, 2007 Just try this:W = 600;H = 400;window.resizeTo(W,H); Link to comment Share on other sites More sharing options...
The Sea King Posted November 10, 2007 Author 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" Link to comment Share on other sites More sharing options...
Ingolme Posted November 10, 2007 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. Link to comment Share on other sites More sharing options...
The Sea King Posted November 10, 2007 Author 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> Link to comment Share on other sites More sharing options...
Synook Posted November 10, 2007 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> Link to comment Share on other sites More sharing options...
The Sea King Posted November 10, 2007 Author Share Posted November 10, 2007 nope. didn't work. Link to comment Share on other sites More sharing options...
Ingolme Posted November 10, 2007 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. Link to comment Share on other sites More sharing options...
justsomeguy Posted November 12, 2007 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. Link to comment Share on other sites More sharing options...
Ingolme Posted November 12, 2007 Share Posted November 12, 2007 That wasn't in the original code I gave. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted November 13, 2007 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 -.- Link to comment Share on other sites More sharing options...
Ingolme Posted November 13, 2007 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. Link to comment Share on other sites More sharing options...
jesh Posted November 13, 2007 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();} Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted November 14, 2007 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();} ? Link to comment Share on other sites More sharing options...
justsomeguy Posted November 14, 2007 Share Posted November 14, 2007 You could put it in onload. Link to comment Share on other sites More sharing options...
SpOrTsDuDe.Reese Posted November 15, 2007 Share Posted November 15, 2007 Yea. Try that. <body onload="clearScreen()">function clearScreen(){ document.open(); document.write(""); document.close();} Try that. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.