时间:2021-04-16
1.向项目中添加Jscript文件
//script_1.js-----
function doClick1()
{
alert("OK1_wufeng");
}
//script_2.js-----
function doClick2()
{
alert("OK2");
}
2.解决方案资源管理器中,右键查看script_1.js和script_2.js的属性,把高级中的“生成操作”属性设置成“嵌入的资源”。
3.向AssemblyInfo.cs文件中添加如下行:(注意域名wf.ClientScriptResourceLabel)
[assembly: System.Web.UI.WebResource("wf.ClientScriptResourceLabel.script_1.js", "application/x-javascript")]
[assembly: System.Web.UI.WebResource("wf.ClientScriptResourceLabel.script_2.js", "application/x-javascript")]
4.向项目中添加一个类, 实例:
using System;
using System.Drawing;
using System.Web.UI;
using System.Web;
using System.Globalization;
namespace wf.ClientScriptResourceLabel
{
public class ClientScriptResourceLabel : System.Web.UI.WebControls.WebControl
{
//调用脚本资源
protected override void OnPreRender(EventArgs e)
{
if (this.Page != null)
{
this.Page.ClientScript.RegisterClientScriptResource(typeof(ClientScriptResourceLabel), "wf.ClientScriptResourceLabel.script_1.js");
this.Page.ClientScript.RegisterClientScriptResource(typeof(ClientScriptResourceLabel), "wf.ClientScriptResourceLabel.script_2.js");
}
base.OnPreRender(e);
}
/// <summary>
/// 呈现控件的方法RenderContents
/// </summary>
protected override void RenderContents(HtmlTextWriter output)
{
output.AddAttribute("id", "1");
output.AddAttribute("type", "checkbox");
output.AddAttribute("value", "测试1");
output.AddAttribute("onclick", "javascript:doClick1();");
output.RenderBeginTag(HtmlTextWriterTag.Input);
output.RenderEndTag();
output.AddAttribute("id", "2");
output.AddAttribute("type", "checkbox");
output.AddAttribute("value", "测试2");
output.AddAttribute("onclick", "javascript:doClick2();");
output.RenderBeginTag(HtmlTextWriterTag.Input);
output.RenderEndTag();
base.RenderContents(output);
}
}
}
声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。
Go链接库系统的难用可谓是人尽皆知,不同Go版本编译出来的不兼容,而且只支持GNU的,不能编译出Windows上的dll和lib。本次有需求是将Go代码编译成3
本文实例讲述了C#实现将javascript文件编译成dll文件的方法。分享给大家供大家参考,具体如下:第一步:新建项目添加js文件写个测试Function(J
dll文件打开方法是:dll文件是系统的动态链接库文件,可以用一些十六位文本编辑器打开,如UltraEdit。 DLL是DynamicLinkLibrary的
编译器主要用来把源代码编译成目标文件,链接器则用来把目标文件和库文件链接成可执行文件。 编译器对源文件进行编译,在这个过程中,编译器会进行一系列的语法检查。如
dll是什么文件?DLL文件对于电脑运行很重要,万一缺了某个DLL文件,可能会导致某些软件或程序无法启动。那么dll文件如何使用呢?dll文件是系统的动态链接库