惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

博客园 - Kevin

换工作了,记录一下面试情况 打工的就是打工的! 超强的希捷硬盘 如何一次性取出每个类别下的前n条记录 在一个表里添加了一记录,怎样取得这条记录的id 发布程序到远程服务器 DNN所有表结构 web.config信息及RSA加密方式! Using JavaScript to show the current time for the end user HtmlGenericControl操作meta标记 window2k3集成sp1光盘启动工具版 CodeSmith资源 华硕网站ajax应用分析-js脚本 Ajax程序设计入门 SQL Server端口更改后的数据库连接方式 windows2003server自带防火墙导致sql server2k无法访问,谁有好办法? 局域网访问access数据库 dreamweaver+asp+access+vss不该犯的错误 windows2k3server远程桌面连接,”终端服务器超出了最大允许连接数“的解决办法
vs2005调用js脚本方法总结
Kevin · 2005-12-29 · via 博客园 - Kevin

1 Using the RegisterClientScriptBlock method

<%@ Page Language=”VB” %>
<script runat=”server”>
Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs)
Dim myScript As String = “function AlertHello() { alert(‘Hello ASP.NET’); }”
Page.ClientScript.RegisterClientScriptBlock(
Me.GetType(), “MyScript”, _
myScript, 
True)
End Sub

</script>
<html xmlns=”http://www.w3.org/1999/xhtml” >
<head runat=”server”>
<title>Adding JavaScript</title>
</head>
<body>
<form id=”form1” runat=”server”>
<div>
<asp:Button ID=”Button1” Runat=”server” Text=”Button”
OnClientClick
=”AlertHello()” />
</div>
</form>
</body>
</html>

<%@ Page Language=”C#” %>
<script runat=”server”>
protected void Page_Load(object sender, EventArgs e)
{
string myScript = @”function AlertHello() { alert(‘Hello ASP.NET’); }”;
Page.ClientScript.RegisterClientScriptBlock(
this.GetType(),
“MyScript”, myScript, 
true);
}

</script>

2 Using Page.ClientScript.RegisterStartupScript

Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs)
Dim myScript As String = “alert(document.forms[0][‘TextBox1’].value);”
Page.ClientScript.RegisterStartupScript(
Me.GetType(), “myKey”, myScript, _
True)
End Sub

protected void Page_Load(object sender, EventArgs e)
{
string myScript = @”alert(document.forms[0][‘TextBox1’].value);”;
Page.ClientScript.RegisterStartupScript(
this.GetType(),
“MyScript”, myScript, 
true);
}

3 Using the RegisterClientScriptInclude method

Dim myScript As String = “myJavaScriptCode.js”
Page.ClientScript.RegisterClientScriptInclude(“myKey”, myScript)

string myScript = “myJavaScriptCode.js”
Page.ClientScript.RegisterClientScriptInclude(“myKey”, myScript);

This creates the following construction on the ASP.NET page:
<script src=”myJavaScriptCode.js” type=”text/javascript”></script>