• kkoenig
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
Hi All,
Can anybody tell, how to call, the javascript onload() function in the <body> in a javascript. I wanted to call an alert statement, through a javascript on the onload function. Please help. Below is the code for reference:
 
<apex:page>
  
    <script type="text/javascript" src="/js/functions.js"></script>
    <script src="/soap/ajax/11.1/connection.js"></script>
    
<apex:pageBlock>
<apex:form>
  
<body onload="init();">       
<table width="100%">
<tr>
<td>
  <input type="text" id="txtName" />
  <input type="button" value="Save"  />
 
</td>
</tr>
</table>
</body>
 <script language="javascript">
sforce.connection.sessionId = '{!$Api.Session_ID}';
function init()
{
  alert('hi');
}
 </script>

  </apex:form>
</apex:pageBlock>
</apex:page>
  • December 26, 2008
  • Like
  • 0