/    Sign up×
Community /Pin to ProfileBookmark

Quick Question – Window.open()

hi guys,

I have a href in a jsp which opens a new browser window using

<a href=”javascript:window.open(‘<%=rs.getString(“url”)%>’,'<%=rs.getString(“name”)%>’)”><%= rs.getString(“name”) %></a>

On clicking the link, it does open a new browser window as expected BUT the parent window browser becomes empty with only one thing written i.e. [object].

Where am i going wrong ? ?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KeshavaRMay 07.2003 — Try using -

onClick Event instead of <a href></a>, which would eventually trigger a function having your window.open code

function test()

{

window.open('<%=rs.getString("url")%>','<%=rs.getString("name")%>')"><%= rs.getString("name") %>

}

and <td onclick="test()">Link Name Here</td>
Copy linkTweet thisAlerts:
@CharlesMay 07.2003 — [font=georgia]That would be bad. It would give you a link that didn't do anything for one in ten people and cause all kinds of trouble for people using non-visual browsers. Use instead:[/font]

[font=monospace]<a href="<%=rs.getString("url")%>" onclick="window.open(this.href, '<%=rs.getString("name")%>'); return false"><%=rs.getString("name")%></a>[/font]
Copy linkTweet thisAlerts:
@RJ2003authorMay 07.2003 — Thanks Charles & KeshavaR....i used Charles solution and it worked.

Great !
×

Success!

Help @RJ2003 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.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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