/    Sign up×
Community /Pin to ProfileBookmark

how to open in target location

Hi all

I am trying to get this code to work.
Well it works but I need to open the link in a target window named bottomleft. The way it is now when button is clicked the window opens up in the same window. What i need is for it to open up in a target window. The code is as follows.

<html>
<head>
<title>buttonmenu
</title>

<SCRIPT LANGUAGE=”JavaScript”>

function goToURL() { window.location = “home.html”; }

function goToURL1() { window.location = “resume.html”; }

function goToURL2() { window.location = “bio.html”; }

function goToURL3() { window.location = “poetry.html”; }

function goToURL4() { window.location = “photo album.html”; }

function goToURL5() { window.location = “form.html”; }

function goToURL6() { window.location = “contact.html”; }

</script>

</head>

<BODY bgcolor=”black”>

<form><center><b>

<input type=button value=”HOME ” onClick=”goToURL()”>

<br><br>

<input type=button value=”RESUME ” onClick=”goToURL1()”>

<br><br>

<input type=button value=”BIO ” onClick=”goToURL2()”>

<br><br>

<input type=button value=”POETRY ” onClick=”goToURL3()”>

<br><br>

<input type=button value=”PHOTO ” onClick=”goToURL4()”>

<br><br>

<input type=button value=”FORM ” onClick=”goToURL5()”>

<br><br>

<input type=button value=”CONTACT ” onClick=”goToURL6()”>

</form>
</body>
</html>

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Mr_JNov 12.2005 — Please try the following

[code=php]<html>
<head>
<title>buttonmenu</title>

<script type="text/javascript">
<!--
function goToURL(url){
newWin = open(url,'bottomleft','width=200,height=100,top=300,left=250' )
}
//-->
</script>

</head>


<BODY bgcolor="black">

<form><center><b>

<input type=button value="HOME " onClick="goToURL('home.html')">

<br><br>

<input type=button value="RESUME " onClick="goToURL('resume.html')">

<br><br>

<input type=button value="BIO " onClick="goToURL('bio.html')">

<br><br>

<input type=button value="POETRY " onClick="goToURL('poetry.html')">

<br><br>

<input type=button value="PHOTO " onClick="goToURL('photo album.html')">

<br><br>

<input type=button value="FORM " onClick="goToURL('form.html')">

<br><br>

<input type=button value="CONTACT " onClick="goToURL('contact.html')">

</form>
</body>
</html>[/code]
Copy linkTweet thisAlerts:
@krazykleenauthorNov 12.2005 — hey thank you that worked great. Just one more thing is there a way I can change the style of the butttons? Thanx
Copy linkTweet thisAlerts:
@Mr_JNov 12.2005 — You can apply css attributes to the button or create a style rule as per the example below.

You can create seperate rules for each mouse event, it really depends what you want, you could even use an image.

<style>

.button_style{

background-color:#0000AA;

color:#AAAAFF;

border:1px solid #FF0000;

}

</style>

<input class="button_style" type="button" value="Button">
Copy linkTweet thisAlerts:
@CharlesNov 12.2005 — If you are going to change the style of the buttons then try:&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;meta name="Content-Script-Type" content="text/javascript"&gt;
&lt;meta name="Content-Style-Type" content="text/css"&gt;

&lt;style type="text/css"&gt;
ul#navigation {
list-style-type:none;
margin:0;
paing:0;
}

#navigation li {margin:1em 0}

#navigation a:link, a:visited, a:hover, a:active {
border:solid #f00 1px;
color:#f00;
background-color:#a00;
display:block;
text-align:center;
text-decoration:none;
width:10em;
}

#navigation a:active {
background-color:#f00;
color:#a00;
}

&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
&lt;ul id="navigation"&gt;
&lt;li&gt;&lt;a href="fee.html"&gt;Fee&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="fie.html"&gt;Fie&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="foe.html"&gt;Foe&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="fum.html"&gt;Fum&lt;/a&gt;&lt;/li&gt;
&lt;/body&gt;
&lt;/html&gt;
That way the one in ten, or whatever it is, that do not use JavaScript will still be able to use your page.
×

Success!

Help @krazykleen 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...