aspx C#
<input id="HiddenField1" type="hidden" value="" />
<script>
var str1="<%=menu.menu1(0) %>";//这是数据库里的读出的内容str1="document.writeln(\""+str1.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\'/g,"\\\'").replace(/\"/g,"\\\"").split('\r\n').join("\");\ndocument.writeln(\"")+"\");" // 生成jsalert(str1);//查看,生成是成功了location.href='leftSave.aspx?HiddenField1='+str1; //把值给这个 leftSave.aspx 页面 生成js文件 但是这里提示"无效语法"
</script>请问这个变量怎么才能传送过去>
<input id="HiddenField1" type="hidden" value="" />
<script>
var str1="<%=menu.menu1(0) %>";//这是数据库里的读出的内容str1="document.writeln(\""+str1.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/\'/g,"\\\'").replace(/\"/g,"\\\"").split('\r\n').join("\");\ndocument.writeln(\"")+"\");" // 生成jsalert(str1);//查看,生成是成功了location.href='leftSave.aspx?HiddenField1='+str1; //把值给这个 leftSave.aspx 页面 生成js文件 但是这里提示"无效语法"
</script>请问这个变量怎么才能传送过去>
解决方案 »
- wcf问题 谁知道呢 看看
- RadioButtonList的RadioButtonList1_SelectedIndexChanged事件为什么激活不了呢?
- asp.net(c#)后台left.aspx页面树杈结构如何实现
- 从xml文件里读取属性值到C#字符串,里面的\都成了 \\ , 有什么办法解决?
- 水晶报表登录失败
- 求救!无法搞定DataGrid的某一列限制字符长度。。。。。。。。。。最后10分
- 请问在.net2005中如何嵌入调用excel程序集!!!
- 做了个退出!这样写为什么不能让COOKIE过期失效
- 请教各位大虾,用DataList怎么实现分页显示?
- 调用js的问题!!-waiting!!!
- 小白求大神vs2012 结合 MySQL 实现单点登录
- 怎样把EXCEL中的图片导入到SQL中
注意str1 将HTMLCode屏蔽掉 要不然传过去不准确的
string csText = "alert('Hello')";
//ClientScriptManager 类用于管理客户端脚本并将它们添加到 Web 应用程序中
ClientScriptManager cs = this.ClientScript;
Type cstype = this.GetType();
if (!cs.IsStartupScriptRegistered(cstype, ""))
{
/* type 要注册的启动脚本的类型
* key 要注册的启动脚本的键
* script 要注册的启动脚本文本
* addScriptTags 指示是否添加脚本标记的布尔值
*/
cs.RegisterStartupScript(cstype, "", csText, true);
}