I have this javascript:
<script language="javascript" type="text/javascript">
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" && 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);
}
</script>
And I'm trying to call this function from my code behind as follows:
Dim Message As String = "This is My new Message"
Dim url As String = HttpContext.Current.Request.Url.AbsoluteUri
Dim script As String = "NewWindow(" & url & "," & Message & ",200,50,Yes,random)"
If Not Page.ClientScript.IsStartupScriptRegistered(Me.GetType(), "alertscript") Then
Page.ClientScript.RegisterStartupScript(Me.GetType(), "alertscript", script, True)
End If
The all idea is to have popup windows in case or error messages in my web site.
The vb code is taking all the attributes I want.
But the function in my aspx.page is not called.
LoadEvent.