/    Sign up×
Community /Pin to ProfileBookmark

adding links to images

I have this gallery I´m doing: [url]http://amedeldesign.com/test.htm[/url]
but I want to have links on the big images, a different link for image that´ll open on a new window. I don´t know how to incorporate that into the already existing javascript.

Can anyone help me? Thanks!

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoNov 15.2005 — <a href="whateverpageyouwanttoload" target="_blank"><img name="image1" src="image1.jpg"></a>

then just change the href, name, and src to whatever you need.
Copy linkTweet thisAlerts:
@the_treeNov 15.2005 — I reckon you'd find this easier starting with a less restrictive script.[code=html]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>
Awnsers
</title>
<script type="text/javascript">
<!--
function switch1(div) {
var option=['a','b','g','d'];
for(var i=0; i<option.length; i++) {
if (document.getElementById(option[i])) {
obj=document.getElementById(option[i]);
obj.style.display=(option[i]==div)? "block" : "none";
}
}
}

window.onload=function () {switch1('a')}
//-->
</script>
<style type="text/css">
<!--
a{
color: #66f;
text-decoration: none;
}
a:hover{
text-decoration: underline;
}
ul#nav{
float: left;
width: 200px;
margin: 0;
padding: 0;
list-style-type: none;
font-weight: 900;
}
li{
margin: 5px;
padding: 1px;
border: 1px solid #ccc;
cursor: pointer;
}
li:hover{
background: #ddd;
}
div#contain{
margin-left: 20px;
float: left;
width: 500px;
}
-->
</style>
</head>
<body>
<h1>
Switching Content
</h1>
<ul id="nav">
<li onclick="switch1('a')">Gallery Alpha
</li>
<li onclick="switch1('b')">Gallery Beta
</li>
<li onclick="switch1('g')">Gallery Gamma
</li>
<li onclick="switch1('d')">Gallery Delta
</li>
</ul>
<div id="contain">
<div id="a">
<a href=""><img src="#" alt="Something"></a>
</div>
<div id="b">
<a href=""><img src="#" alt="Something else"></a>
</div>
<div id="g">
<a href=""><img src="#" alt="Yet another something"></a>
</div>
<div id="d">
<a href=""><img src="#" alt="Nothing"></a>
</div>
</div>
</body>
</html>[/code]
Copy linkTweet thisAlerts:
@arielmedelauthorNov 15.2005 — Thanks the tree. I´ll try your suggestion ?
×

Success!

Help @arielmedel 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,
)...