Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling Javascript code from an Image Button
Message
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
ASP.NET
OS:
Vista
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01479935
Message ID:
01479939
Views:
26
>How do I call the below JavaScript from my image button using C# 4.0 in ASP.NET?
>
>Code Behind Page:
>
>namespace Company
>{
>    public partial class About : System.Web.UI.Page
>    {
>        protected void Page_Load(object sender, EventArgs e)
>        {
>
>        }
>
>        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
>        {
>
>        }
>    }
>}
>
>
>This is in my ASPX page:
>
>< script language="JavaScript" type="text/javascript">
>    <!--
>    // Put your e-mail username in the quotes after var YourUserName
>    // Put your domain name in the quotes after var YourDomainName
>    // Put the text that should appear on the page in the quotes after var
>    message
>    
>    var YourUserName = "bubba";
>    var YourDomainName = "gump.com";
>    var message = "Click here to e-mail us";
>    
>    var mail = YourUserName + "@" + YourDomainName;
>    document.write("<a href=\"mailto:"+mail+"\">"+message+"</a>");
>    //-->
>< /script>
>
Simplest:
< script language="JavaScript" type="text/javascript">
         function SendMail() {
            var YourUserName = "bubba";
            var YourDomainName = "gump.com";
            var message = "Click here to e-mail us";
            var mail = YourUserName + "@" + YourDomainName;
            document.write('whatever');
        }
     < /script>
    < asp:ImageButton ID="ImageButton1" runat="server"  OnClientClick="SendMail();"/>
Previous
Reply
Map
View

Click here to load this message in the networking platform