/    Sign up×
Community /Pin to ProfileBookmark

need help opening new windows from links

Hi,

I have a page with a list of links that must open in new windows for review.

Since I’m new to javaScripting, I downloaded a script that is supposed to do this and it works fine on the first link, but when I apply the script to the rest of the links, it always launches the last link to which the script was applied to.

I’am posting the script for anyone to review and figure out where the problem might be, and thanks in advance for the help!

<!–//hide script from old browsers
function launch() {
open(‘[B]PAGE.htm[/B]‘, ‘[B]DON’T KNOW WHAT TO WRITE HERE[/B]‘, ‘resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, width=100, height=100’) }
document.write(‘<A HREF=”javascript:launch()”>[B]TEXT TO BE SHOWN[/B]</A>’)
//end hiding contents –>

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@sciguyryanOct 11.2004 — When you said: "DON'T KNOW WHAT TO WRITE HERE" You should ahve the name you wnt given to the window.


But, I do not understand your problem.

Can you explain more clearly?

RyanJ
Copy linkTweet thisAlerts:
@oreofudgeauthorOct 11.2004 — Ryan,

I have more than ten names in a page; when clicked, a new window must open displaying the info for that name, without closing the parent window.

I downloaded the script shown on my previous post; pasted it in the body where the link must be shown and substituted the corresponding values for each link.

After doing this and testing this page in IE, all links look ok in the page, at least the names shown are correct, but when clicked each of them open the same window, which is the one that correspond to the last link pasted on the page, so instead of each link opening its designated target, they all open the one that correspond to the last pasted script.

I hope this makes it clearer...
Copy linkTweet thisAlerts:
@agent_x91Oct 11.2004 — 
open('PAGE.htm', 'DON'T KNOW WHAT TO WRITE HERE', 'resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, width=100, height=100')
[/QUOTE]


You are missing the semi-colon on the end of the this statement - it's not necessary in javascript if you only haveo ne statement in the block, but it's important to remember.


<A HREF="java script:launch()">
[/QUOTE]


also here it should be javascript: not java script:

plus, it should be in the "onClick=" event handler, not href=.

[CODE]
<a href="#" onClick="launch();">link text</a>
[/CODE]
Copy linkTweet thisAlerts:
@Warren86Oct 11.2004 — <HTML>

<Head>

<Script Language=JavaScript>

function launch(isURL) {

open(isURL,'newWindow', 'resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, width=400, height=300') }

</Script>

</Head>

<Body>

<A HREF="javascript:launch('nextPage1.html')"> This is a Link to another URL</A><br>

<A HREF="javascript:launch('nextPage2.html')"> This is a Link to another URL</A><br>

<A HREF="javascript:launch('nextPage3.html')"> This is a Link to another URL</A>

</Body>

</HTML>
×

Success!

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