-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: sunsandle
Message 1 in Discussion
Hi, The requirement is like I want to call one javascript function in onload event
of body tag at run time in code behind of asp.net page. I dont want to hard code this
function in onload event becuase this javascript function accepts some parameters and
the value for this parameter come from database. for example 'code in page1.aspx
<HTML>
<HEAD>
<title>WebForm6</title>
<script language="javascript">
function try1(strMsg)
{
alert(strMsg);
}
</script>
</HEAD>
<body id="b1">
<form id="Form1" method="post" runat="server">
<asp:textbox id="TextBox1" style="Z-INDEX: 101; LEFT: 184px; POSITION: absolute;
TOP: 80px" runat="server"></asp:textbox></form>
</body>
</HTML> 'code in page1.aspx is end here 'code in page1.aspx.vb Private Sub
Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
Dim strJS As String
strJS = strJS & "<Script language='Javascript'>" & vbCrLf
strJS = strJS & "document.body.onload = try1('hi')" & vbCrLf
strJS = strJS & "</Script>"
Response.Write(strJS)
End Sub 'code for page1.aspx.vb end here When I run the above code
it throws following javascript error : Microsoft JScript runtime error:
'document.body' is null or not an object How to handle onload event of body at
runtime in asp.net any suggestions. Thanks and regards Nilesh W
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]