codice:
...
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script type="text/javascript">
function saluto()
{
alert('ciao a tutti !');
}
</script>
</head>
...
Io uso questa:
codice:
Public Sub EseguiScript(ByVal Pagina As System.Web.UI.Page, ByVal NomeScript As String)
Dim js As String = "<script language=javascript> " & NomeScript & "(); </script>"
If (Not ClientScript.IsClientScriptBlockRegistered("esegui_js")) Then
ClientScript.RegisterClientScriptBlock(Pagina.GetType, "esegui_js", js)
End If
End Sub
Così:
codice:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
EseguiScript(Me, "saluto")
End Sub