如何在C#ASP.NET中编写JavaScript [英] how to write javascript in c# asp.net
本文介绍了如何在C#ASP.NET中编写JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在.net中编写一个javascript.
示例脚本:
i want to write a javascript in .net.
example script:
function enableForm() {
document.getElementById("form").disabled = false;
}
window.onLoad = enableForm();
谢谢
where i want to include this script can anybody help?.thanks
推荐答案
尝试一下.
Try this.
<html>
<head id="Head1" runat="server">
<script type="text/javascript" language="javascript">
function enableForm() {
document.getElementById("form").disabled = false;
}
</head>
<body önload="enableForm()">
.
.
.
</body>
</body>
以此开头 [
您可以尝试一下也是.
you can try this one too.
string myScriptValue = "function enableForm() {document.getElementById("form").disabled = false;}window.onLoad = enableForm();"; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "myScriptName", myScriptValue, true);
我从来没有调试过它,所以我不确定它的语法是否可用:)
I have never debug this so im not sure if its syntax free :)
这篇关于如何在C#ASP.NET中编写JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文