Click to See Complete Forum and Search --> : Use window.open for same URL but with different buttons


jochem
11-07-2003, 03:49 PM
I am writing a page people can use to check how their site appears in different browsers and at different screen-resolutions. The idea is that webdesigers enter an URL, and then press different buttons depending on the view they want.

The old version of the page can be found at www.alpinetrekking.com/canvas. The version I am working on now is attached to this message.

I have no experience in writing JavaScript, so any help would be very much appreciated.

Ciao, Jochem :cool:

jochem
11-07-2003, 03:58 PM
Hmm... since I don't see my uploaded script anywhere in this forum, I'll just post it here:



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>

<title>How does my page look?</title>

<style>
.Input {font:8pt Verdana, Arial; height:20; width:204;}
.Button1{font:8pt Verdana, Arial; height:20; width:100;}
.Button2{font:8pt Verdana, Arial; height:20; width:100; color:#FF0000;}
</style>

<script language="JavaScript">
var whereTo;
var parsing;

function goThere(){
whereTo = '';
whereTo = document.Address.Entry.value;
parsing = whereTo.substring(0,7);
parsing = parsing.toLowerCase();
if (parsing != 'http://') whereTo="http://"+whereTo;
if (whereTo.length>12){

var b = button.name;
if (b=640x480) {window.open('href=whereTo','640x480', 'toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width=640,height=480 ')}
else if (b=800x600) {window.open('href=whereTo','800x600', 'toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width=800,height=600 ')}
else if (b=1024x768) {window.open('href=whereTo','1024x768', 'toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width=1024,height=76 8')}
else if (b=1152x864) {window.open('href=whereTo','1152x864', 'toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width=1152,height=86 4')}
else if (b=1280x1024) {window.open('href=whereTo','1280x1024','toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar= yes,directories=yes,width=1280,height=1024')}

else if (b=SAFE640x480) {window.open('href=whereTo','640x480', 'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=599,height=290')}
else if (b=SAFE800x600) {window.open('href=whereTo','800x600', 'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=759,height=410')}
else if (b=SAFE1024x768) {window.open('href=whereTo','1024x768', 'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=983,height=578')}

else if (b=SAFE640x480S) {window.open('href=whereTo','640x480', 'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=584,height=290')}
else if (b=SAFE800x600S) {window.open('href=whereTo','800x600', 'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=744,height=410')}
else if (b=SAFE1024x768S){window.open('href=whereTo','1024x768', 'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,width=968,height=578')}

else {window.open('href=whereTo')}

document.Address.Entry.value = whereTo;
document.Address.action = 'navigation.htm'+'?'+whereTo;
}
}
</script>

</HEAD>



<BODY>

<p>
<table border="0" cellpadding="0" cellspacing="5">
<form name="Address" method="post" onSubmit="javascript:return false">
<tr><td><input type="text" class="Input" value="http://" name="Entry">
<input type="reset" class="Button1" value="reset" name="Reset"></td></tr>
<tr><td><input type="button" class="Button2" value="599x290" name="SAFE640x480" onClick="javascript:goThere()">
<input type="button" class="Button2" value="759x410" name="SAFE800x600" onClick="javascript:goThere()">
<input type="button" class="Button2" value="983x578" name="SAFE1024x768" onClick="javascript:goThere()"></td>
</tr>
</form>
</table>
</p>

</BODY>
</HTML>