Monday, November 30, 2009

Very Good trick for adding a body onload function for Mater Page.

On MasterPage.master
...
<head>

<asp:contentplaceholder runat="server" id="Headers">

</asp:ContentPlaceHolder>
<script language="javascript">
function mp_onload()
{
if(window.body_onload != null)
window.body_onload();
}
</script>
</head>
<body onload="mp_onload();">


On Content aspx page.
function body_onload() {
....
}


From Alex Wight.

God bless Internet~

Good Artical to deal with the ID in Javascript with Master Page

http://www.codeproject.com/KB/scripting/Masterpage-Javascript.aspx

I hate .NET's Mater Page feature thought. SUCKS~

Thursday, November 5, 2009

Radio button getting 'Object doesn't support this property or method' - javascript

When I add the onclick event to the radio button. I keep getting this 'Object doesn't support this property or method'.

Finally I find out it is because my name of the radio button and the function name in javascript is identical.

Don't use the same name in the future.