form.submit (javascript) and master pages

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
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,118
Latest member
LatishaWhy
Top