function square(num){ var total = num*num;//局部变量 return total;}var total = 50;//全局变量var number = square(20);alert(total);//结果为50 function square(num){ total = num*num;//全局变量 return total;}var total = 50;//全局变量var number = square(20);alert…
<html> <head> <script language="javascript"> function getCursortPosition (ctrl) {//获取光标位置函数 var CaretPos = 0; // IE Support if (document.selection) { ctrl.focus (); var Sel = document.selection.createRange (); Sel.moveStart ('c…
如题,相信这个函数百度一搜一大推,但令人匪夷所思的是这些函数都写的“奇形怪状的”,例如http://www.cnblogs.com/windows7/archive/2010/03/30/1700648.html,考虑的倒是挺周全:id可以直接引用.cssFloat/styleFloat.属性大小写改为“-”,但这还是js吗? 我来个简单点的,在这保存备份一下: var cssStyle = function (elem,name,value){ if (elem.currentStyle){…
在JSP页面中.常常使用javascript,可是要出javascript获取存储在request,session, application中的值.例如以下是获取request中的值: 如果后台中有: request.setAttribute("value", "123"); 在前台的javascript中有例如以下获取方式: 1 : var val = "${value}"; 2: var val = "<%=request.…
koa-session2 Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb with Babel koa-session2 Middleware for Koa2 to get/set session use with custom stores such as Redis or mongodb with Babel If you are not using bab…