/    Sign up×
Community /Pin to ProfileBookmark

Use window.open for same URL but with different buttons

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 [url]www.alpinetrekking.com/canvas.[/url] 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 ?

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@jochemauthorNov 07.2003 — 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=768')}

else if (b=1152x864) {window.open('href=whereTo','1152x864', 'toolbar=yes,status=yes,scrollbars=yes,location=yes,menubar=yes,directories=yes,width=1152,height=864')}

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>
×

Success!

Help @jochem spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...