Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How opening a window from an hyperlink

Status
Not open for further replies.

vilrbn

Programmer
Oct 29, 2002
105
FR
Hello,

I manage to open a window from an HTML button, but not from an Hyperlink as it has no Onclick event.
How can I handle this ?

<script language=&quot;javascript&quot;>
<!---->
function OpenWin(sURL)
{
myWin= open(sURL, &quot;ProductWindow&quot;, &quot;width=320,height=240,status=no,toolbar=no,menubar=no,resizable=yes,scrollbars=no,screenX=0,screenY=0&quot;);
myWin.resizeTo(500,400);
myWin.moveTo(0,0);
myWin.focus();
}
</script>


<INPUT style=&quot;Z-INDEX: 103; LEFT: 461px; POSITION: absolute; TOP: 656px&quot; type=&quot;button&quot; value=&quot;Open Product&quot; onclick=&quot;javascript:OpenWin('addProduct.aspx')&quot;>

Thanks for your help !
 
Use the HyperLink button. It looks the exact same as a hyperlink except that it does have an onclick event. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Do you mean using a LinkButton ? I tried but if I use the same code:

<asp:LinkButton id=&quot;LinkButton1&quot; runat=&quot;server&quot; OnClick =&quot;javascript:OpenWin('addProduct.aspx')&quot; >LinkButton</asp:LinkButton>

I get this error message:

'javascript' is not a member of 'ASP.myForm_aspx'.

I also tried to launch it through code-behind:

<asp:LinkButton id=&quot;LinkButton1&quot; runat=&quot;server&quot; OnClick = &quot;LinkButton_Click&quot;>LinkButton</asp:LinkButton>

Public Sub LinkButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles LinkButton1.Click
Response.Write(&quot;<Script Language='Javascript'>OpenWin('addProduct.aspx');</script>&quot;)
End Sub

But it never go into my VB code when I click on the button.

Can you help me ?
 
In fact I don't want to display toolbars, scrollbars and menubar. I also need to control the size of the window.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top