Note that there are some explanatory texts on larger screens.

plurals
  1. POCalling JavaScript from code Behind in aspx
    primarykey
    data
    text
    <p>I have this javascript: </p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function NewWindow(mypage, myname, w, h, scroll, pos) { var win = null; if (pos == "random") { LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100; TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100; } if (pos == "center") { LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100; TopPosition = (screen.height) ? (screen.height - h) / 2 : 100; } else if ((pos != "center" &amp;&amp; pos != "random") || pos == null) { LeftPosition = 0; TopPosition = 20 } settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no'; win = window.open(mypage, myname, settings); } &lt;/script&gt; </code></pre> <p>And I'm trying to call this function from my code behind as follows: </p> <pre><code>Dim Message As String = "This is My new Message" Dim url As String = HttpContext.Current.Request.Url.AbsoluteUri Dim script As String = "NewWindow(" &amp; url &amp; "," &amp; Message &amp; ",200,50,Yes,random)" If Not Page.ClientScript.IsStartupScriptRegistered(Me.GetType(), "alertscript") Then Page.ClientScript.RegisterStartupScript(Me.GetType(), "alertscript", script, True) End If </code></pre> <p>The all idea is to have popup windows in case or error messages in my web site.<br/> The vb code is taking all the attributes I want.<br/> But the function in my aspx.page is not called.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload