javascript 调用 jsp的变量
找下面写法。
注意,加单引号,第2个百分号之前没有空格,而在jsp中调用的话要空格。
You may be get some help from the code below.
<%
String str="str";
%>
<script>
function accessVar(){
var varStr='<%=str%>';
alert(varStr);// here will diplay 'str'
}
</script>
相关文档:
function urlencode( str ) {
// http://kevin.vanzonneveld.net
// + original by: Philip Peterson
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: urlencode('Kevin van Zonneveld!');
// * returns 1: 'Kevin+van+Zonneveld%21'
&nb ......
//关闭,父窗口弹出对话框,子窗口直接关闭
this.Response.Write("<script language=javascript>window.close();");
//关闭,父窗口和子窗口都不弹出对话框,直接关闭
this.Response.Write("");
this.Response.Write("{top.opener =null;top.close();}");
this.Response.Write("");
//弹出窗口刷新当前页面width=20 ......
原创于2007年12月16日,2009年10月15日迁移至此。
JavaScript通过内置的setTimeout函数来完成页面内的定时检查,也是很久以前写的东西了。
之所以想起它来,是因为在和项目组其他成员说该事情的时候,别人竟然嘲笑我说是上个世纪的代码,现在都用WEB2.0了。
<script language="JavaScript" type="text ......