保存隐藏字段值和调用函数 [英] Save in hidden field value and call function
问题描述
ScriptManager.RegisterStartupScript(this,this.GetType(),javascript,if(confirm('在主页显示?')== true)
{document.getElementById(' + hdnvalue.ClientID.ToString()+')。Value ='true'}
else {document.getElementById('+ hdnvalue.ClientID.ToString()+')。Value ='false'} {document.getElementById('+ btnSavechecked.ClientID +')。click()},true);
ScriptManager.RegisterStartupScript(this, this.GetType(), "javascript", "if(confirm('Show in Home Page?')==true)
{document.getElementById('" + hdnvalue.ClientID.ToString() + "').Value='true'}
else{document.getElementById('" + hdnvalue.ClientID.ToString() + "').Value='false'}{document.getElementById('" + btnSavechecked.ClientID + "').click()}", true);
推荐答案
您应该在js文件或脚本标签中创建java脚本函数,之后从代码后面调用它,如:
Hi,
You should create java script function in js file or in script tag, and after that call it from code behind like:
<script type="javascript">
function test(){
// your java script function code here
}
</script>
然后从代码调用test()函数后面,
Then call test() function from code behind,
ScriptManager.RegisterStartupScript(this, this.GetType(), "javascript", "test()", true);
试试这个!
Try this!
document.GetElementById("<%=hdnvalue.ClientID %>").value = "true";
smal中的Value属性l案例JavaScript区分大小写也是一个单独的功能,如上面的RJ009回答中所给出的
Value attribute in small case JavaScript is Case sensitive also make a seperate function as given in Answered by RJ009 above
这篇关于保存隐藏字段值和调用函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!