I have an asp.net page programmed in vb. I'm trying to call the javascript located in the head of the asp.net page "goNewWin()". I'm having trouble with the syntax for the codebehind. I've attached the javascript at the top of the aspx page and the codebehind code. Thanks.
--aspx page code--<head runat="server"> <title>Home</title> <link href="style.css" rel="stylesheet" type="text/css" /><script type="text/javascript"> function goNewWin() { TheNewWin =window.open("music.html",'TheNewpop','toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1'); TheNewWin.blur(); }</script> </head>--vb code behind-- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load If Page.IsPostBack = False Then If Session("Logged_In") Is Nothing Then End If End If End Sub
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
If you want to execute goNewWin() every time the page loads then what TomKnox suggested makes sense. But if you want to set it conditionally then you may use Page.RegisterStartupScript.
CahitEy
Try to use Jquery :) that executes js after page complete, you are facing with error because of render order of asp.net
for add jquery to your page
<script type='text/javascript'>
goNewWin();
</script>