Microsoft JScript 运行时错误: 'document.getElementById(...)' 为空或不是对象



在项目中遇到一个很头疼js问题。

 

第一种方法

string strJS = "<script language='javascript' type='text/javascript'>AlertAndReturn('保存成功');</script>";
ScriptManager.RegisterStartupScript(this, this.GetType(), "client", strJS, false);


第二种方法
string strJS = "AlertAndReturn('保存成功');";
ScriptManager.RegisterStartupScript(this, this.GetType(), "client", strJS, true);

 

发现,第一种方法成功,第二种方法老是弹出脚本问题(在IDE的环境下)

最后跟踪,ScriptManager.RegisterStartupScript(this, this.GetType(), "client", strJS, true);生成的脚本

<script  type='text/javascript'> 少了language='javascript'这一截。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM