Hyperlink Javascript window.open()

J

John

Hi,

I have the following in my asp .net web page. It opens a separate browser
window. However, on the main page, all of the contents is gone and shows
nothing but [object]. I have to use the Back button to get the main page
back.

How can I open a separate browser window and keep all the contents on the
main page? Thanks.

<a href="javascript:window.open('ShowImage.aspx');">Image</a>
 
C

Chad Scharf

Scott M. has definately provided the more correct solution. You might also try,

<a href="" onclick="window.open('ShowImage.aspx');return false;">Image</a>

This will ensure that the href action does not bubble through the page's
client side event cycle and will also not change the page URL by appending a
pound sign. You do not need a value in the href property, the browser will
render an empty href value as a link (if you exclude the href property all
together you will simply get text, not a hyperlink).

--
Chad Scharf
_______________________________
http://www.chadscharf.com


Scott M. said:
<a href="#" onclick="window.open('ShowImage.aspx');">Image</a>


John said:
Hi,

I have the following in my asp .net web page. It opens a separate browser
window. However, on the main page, all of the contents is gone and shows
nothing but [object]. I have to use the Back button to get the main page
back.

How can I open a separate browser window and keep all the contents on the
main page? Thanks.

<a href="javascript:window.open('ShowImage.aspx');">Image</a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top