locked
calling a javascript function from with in the asp:content RRS feed

  • Question

  • Hi,

     i want to call a javascript method when the page loads (aspx). i.e. using onload() function......

     I am using the appication.master page of the MOSS 2007 as the master page for my application...since there is no body tag in the asp content page how should i call the javascript method that i have put in the

    <asp:Content ID="Content3" ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
    function OnLoadFunction()
    {
    document.getElementById('TxtTab').style.display='none';
    SwitchTabs();
    }
    				
    function SwitchTabs()
    {var tb = document.getElementById('TxtTab').value;
    for (var i=1; i<3; i++)
         {
       document.getElementById("Buttion"+i).style.cssText=	"BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 0px solid; BORDER-BOTTOM: black 1px solid; background-color: Gainsboro;" 
         document.getElementById("tblPage"+i).style.display ="none";
       }
         document.getElementById("Buttion"+tb).style.cssText="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid; BORDER-LEFT: black 0px solid; BORDER-BOTTOM: black 0px solid; background-color:  white;" 
    
    document.getElementById("tblPage"+tb).style.display='';
    					
    
       }
    
    function SelectTab(v)
    {
    					
    document.getElementById('TxtTab').value=v;
    SwitchTab(); 
    return false;
    } 
    </asp:content>

       how do i call the OnLoadfunction method onload ?

    Kindly enlight in this prospective

     

    Monday, March 29, 2010 7:25 AM

All replies

  • Hi

    Try ClientScript.RegisterStartupScript method to call the onload function in the content page.

    Tuesday, May 4, 2010 7:16 AM