Click to See Complete Forum and Search --> : Opening another browser window


Ruskin
02-25-2004, 07:54 PM
Ok, I'm new to this. Have been programming in VB so figured ASP wouldn't be difficult to pickup. But have a question;
I am trying to create a link, that opens another browser window;
<a href="http://newpage.com">New Page</a>
Opens newpage in the current browser. I was told to use a 'target' keyword, to name the browser that I wanted the page opened in, like;
<a href="http://newpage.com" target="new_window">...
This works ok, but if I click on the link again, it moves back to the browser I opened, instead of opening another browser. So I tried;
<%
response.write "<a href='http://newpage.com' target='" & RandomWindow() & "'>New Page </a>"
%>
<%
Function RandomWindow()
Dim lngCounter
Dim strReturn
Randomize
For lngCounter = 1 to 8
strReturn = strReturn & Int(Rnd * 10)
Next lngCounter
RandomWindow = "NEW" & strReturn
End Function
%>

Thus, each "target" window now has a unique name (made up of NEW and an 8 digit number). But I still only get a single browser window opening, no matter how many times I click on the link...

Is there another name that I can use in the '<a>' tag, to force a new browser window to open each time?

PeOfEo
02-25-2004, 09:13 PM
No, not with the target attribute. The browser is going to open the pages in that same new window. You can use java script to open windows, but use java script conservativly because it only works for 13% of the internet.

buntine
02-26-2004, 12:57 AM
Actually, javascript work for 87% of internet users.

To open a new window every time use this code:

<a href="pageUrl" target="_blank">your link</a>


The '_blank' keyword will open in a new window. ASP is not needed.

PeOfEo
02-26-2004, 02:08 PM
woops I had a brain fart, I meant java script will not work for 13%.