/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Can a link do two things?

hi,

i want to make a link on my page open to a new page on the website, but also another website in a new window. is this possible?

thanks!

to post a comment
HTML

9 Comments(s)

Copy linkTweet thisAlerts:
@TheBearMayApr 12.2006 — <a href="#" onclick="window.open('newUrl','newWinName');document.location.href='http://URL'>Click here</a>
Copy linkTweet thisAlerts:
@stephen1davisApr 12.2006 — yes. use JS.

<a href="javascript:openIt()">xxx</a>

and then have this in your page.

<script type="text/javascript">

function openIt() {

location.href="where.html";

window.open("location.html","name");

}

</script>

EDIT: yeah, yours is better.
Copy linkTweet thisAlerts:
@zog953authorApr 12.2006 — thebearmay,

i thried that, but i'm not sure i'm doing it right.

<a href="news.html" onclick="window.open('newUrl','newWinName');document.location.href='http://search.ebay.co.uk/_W0QQsassZlinqdistributionQQhtZ-1'><img src="linqebay.jpg"/></a>

does my code make sense? cus it has just cut the image i wanted to use as the link out of the webpage.
Copy linkTweet thisAlerts:
@TheBearMayApr 12.2006 — This would probably work better:

<i>
</i>&lt;a href="#" onclick="window.open('http://search.ebay.co.uk/_W0QQsassZlinqdistributionQQhtZ-1','newWinName');document.location.href='news.html'&gt;&lt;img src="linqebay.jpg"/&gt;&lt;/a&gt;
Copy linkTweet thisAlerts:
@zog953authorApr 12.2006 — for some reason the image still hasn't reappeared, so i can't really tell you if it has worked.
Copy linkTweet thisAlerts:
@TheBearMayApr 12.2006 — Is the image in the same directory as the HTML page? If not you'll need to give it the path to the image.
Copy linkTweet thisAlerts:
@zog953authorApr 12.2006 — it definately is, when i changed the link back to do just one function and connect to the "news.html" page the image reappeared ?
Copy linkTweet thisAlerts:
@TheBearMayApr 12.2006 — I see the problem. I left out a quote. Try this instead:

<i>
</i>&lt;a href="#" onclick="window.open('http://search.ebay.co.uk/_W0QQsassZlinqdistributionQQhtZ-1','newWinName');document.location.href='news.html'"&gt;&lt;img src="linqebay.jpg"/&gt;&lt;/a&gt;
Copy linkTweet thisAlerts:
@zog953authorApr 12.2006 — Sensational! thank you very much, hopefully you wont be hearing from me again too soon.
×

Success!

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