T
Timo
I'm trying to use a LinkButton with both an HREF and an OnClick to defeat
the popup blocker because we have a disproportionately high number of users
who won't know they have popups blocked or even know what a popup is. Our
site opens pages from our affiliates in a popup window.
Why do I get an error saying page http://localhost/www.msn.com cannot be
found? How is 'localhost' entering into the picture? I assume there's a
conflict between the href and the onclick? I'm running the page inside
Visual Studio .NET
In the HTML document:
<script language="javascript">
function LAUNCH(url) {
alert('launch');
window.open(url);
}
</script>
In the code behind:
Public Class WebForm1
Protected WithEvents LB As LinkButton
Private Sub Page_Load (....
LB = New LinkButton
LB.ID = "Test1000"
LB.Attributes("ctrid") = "2468"
Dim url As String = "ht" + "tp:\\" + "www.msn.com"
LB.Attributes("onclick") = "ja" + "vascript:LAUNCH('" + url + "');"
LB.Text = "This is a test link whose click should open a popup"
AddHandler LB.Click, AddressOf TestLinkButtonHandler
Me.Panel1.Controls.Add(LB)
End Sub
Private Sub TestLinkButtonHandler(ByVal sender As System.Object, ByVal e As
System.EventArgs)
End Sub
The rendered HTML:
<a id="Test1000" ctrid="2468"
onclick="javascript:LAUNCH('http:\\www.msn.com');"
href="javascript:__doPostBack('Test1000','')">This is a test--it should
open a popup</a>
the popup blocker because we have a disproportionately high number of users
who won't know they have popups blocked or even know what a popup is. Our
site opens pages from our affiliates in a popup window.
Why do I get an error saying page http://localhost/www.msn.com cannot be
found? How is 'localhost' entering into the picture? I assume there's a
conflict between the href and the onclick? I'm running the page inside
Visual Studio .NET
In the HTML document:
<script language="javascript">
function LAUNCH(url) {
alert('launch');
window.open(url);
}
</script>
In the code behind:
Public Class WebForm1
Protected WithEvents LB As LinkButton
Private Sub Page_Load (....
LB = New LinkButton
LB.ID = "Test1000"
LB.Attributes("ctrid") = "2468"
Dim url As String = "ht" + "tp:\\" + "www.msn.com"
LB.Attributes("onclick") = "ja" + "vascript:LAUNCH('" + url + "');"
LB.Text = "This is a test link whose click should open a popup"
AddHandler LB.Click, AddressOf TestLinkButtonHandler
Me.Panel1.Controls.Add(LB)
End Sub
Private Sub TestLinkButtonHandler(ByVal sender As System.Object, ByVal e As
System.EventArgs)
End Sub
The rendered HTML:
<a id="Test1000" ctrid="2468"
onclick="javascript:LAUNCH('http:\\www.msn.com');"
href="javascript:__doPostBack('Test1000','')">This is a test--it should
open a popup</a>