form.submit (javascript) and master pages

  • Thread starter Thread starter MonkeeX
  • Start date Start date
M

MonkeeX

I am currently converting my web site to include master pages. I have
an image which when clicked on submits the form by using form.submit
in javascript.

As the form not longer exists in an asp:content page (i.e. the form is
in the master page) then how can I achieve the same result in a master
page asp:content page?


Thanks,
Monkey Boy
 
Hi,

<asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1">

<input type="button" value="Click me!" onclick="MyFunction()"/>
<script type="text/javascript">
function MyFunction()
{
var frm = document.getElementById('<%=Page.Form.ClientID %>');
if (frm)
{
frm.submit();
}
}
</script>

</asp:Content>

Hope this helps
 
Back
Top