asp.net c3中的javascript [英] javascript in asp.net c3
本文介绍了asp.net c3中的javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
先生
如何在< form>中调用javascript函数? tag
解决方案
<%@ Page 语言 = C# AutoEventWireup = true CodeFile = Example.aspx.cs 继承 = 示例 %>
< !DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >
< script runat = 服务器 >
protected void buttonclick( object sender,EventArgs e)
{
TextBox1.Text = 您正在使用脚本更新;
}
< / script < span class =code-keyword>>
< html xmlns = http://www.w3.org/1999/xhtml >
< head runat = 服务器 >
< title > < / title >
< / head >
< body >
< 表格 id = form1 runat = server >
< div >
< asp:TextBox ID = TextBox1 runat = server > < / asp:TextBox >
< asp:按钮 ID = Button1 runat = server 文本 = 按钮 onclick = buttonclick / >
< / div >
< / form >
< / body >
< < span class =code-leadattribute> / html >
< pre lang =xml> < html xmlns = http://www.w3 .ORG / 1999 / XHT ml >
< head id = Head1 runat = server >
< title > Untitled Page < / title >
< script >
function test()
{
alert(Hello World);
}
< / script >
< / head >
< body onload = test () >
< 表格 id = form1 runat = server >
< div >
< / div >
< / form >
< / body >
< / html >
sir
how can i call javascript function with in <form > tag
解决方案
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Example.aspx.cs" Inherits="Example" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void buttonclick(object sender, EventArgs e) { TextBox1.Text = "You are using Script to update"; } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" onclick="buttonclick"/> </div> </form> </body> </html>
<html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>Untitled Page</title> <script> function test() { alert("Hello World"); } </script> </head> <body onload="test()"> <form id="form1" runat="server" > <div> </div> </form> </body> </html>
这篇关于asp.net c3中的javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文