Tuesday, May 01, 2007

ASP : Creating Javascript on the server side

Javascript is normally created in the HTML file but it can be created on the server side.

e.g. the script to open another window could be:

string exampleScript =
"LSBscript language='javascript'RSB\n" +
"window.open ('http://some url', '_blank', " +
"'scrollbars=yes,resizable=yes,status=yes" +
",toolbar=no,menubar=yes,location=no" +
",width=screen.availWidth" +
",height=screen.availHeight" +
",screenX=0,screenY=0,top=0,left=0');\n" +

ClientScript.RegisterStartupScript(typeof(Page), "ExampleScript", exampleScript);


LSB = Left square bracket
RSB = Right square bracket


No comments: