日期:2014-05-16 浏览次数:20599 次
//获取当前url参数的值 var getQueryStringRegExp = function(name){ var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i"); if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " ")); return ""; };
------解决方案--------------------
//时间秒数格式化,s为秒数,返回值t格式为:HH:MM:SS function timer_format(s) { var t; if(s > -1){ hour = Math.floor(s/3600); min = Math.floor(s/60) % 60; sec = s % 60; day = parseInt(hour / 24); if (day > 0) { hour = hour - 24 * day; t = day + "day " + hour + ":"; } else t = hour + ":"; if(min < 10){t += "0";} t += min + ":"; if(sec < 10){t += "0";} t += sec; }else t = " OK "; return t; }
------解决方案--------------------
<html> <head> <title>菜单</title> </head> <style type="text/css"> .box{ font: 9pt "Comic Sans MS"; position: absolute; background:pink } </style> <body> <p align="center"></a> </p> <div align="center"><center> <table id="itemopen" class="box" style="display:none"> <tr> <td>弹出菜单</td> </tr> <tr> <td><a href="#">Cut</a></td> </tr> </table> </center></div><!-- End of Popup Menu --> <script language="JavaScript"> document.onclick = popUp function popUp(evt) { evt = evt ? evt : (window.event ? window.event : null); var mX = evt.x ? evt.x : evt.pageX; var mY = evt.y ? evt.y : evt.pageY; newX = mX + document.body.scrollLeft; newY = ((mY)*(-1) + document.body.scrollTop)*(-1); menu = document.getElementById('itemopen'); if ( menu.style.display == ""){ menu.style.display = "none" } else { menu.style.display = "" } if(navigator.appName.indexOf("Explorer") > -1){//IE menu.style.pixelLeft = newX+8; menu.style.pixelTop = newY-5; }else{ menu.style.left = parseInt(newX)+10+"px"; menu.style.top = parseInt(newY)-5+"px"; } } </script> <a href="#" onclick="popUp(event);"><font color="blue">在任意位置单击鼠标左键看看</font></a> </body> </html>
------解决方案--------------------
重在接分。
/// <summary>格式化字符串</summary> /// <param name="template">字符模板</param> /// <param name="json">参数对象</param> /// <returns>返回格式化的字符</returns> /// <example> /// document.write(jsonFormat('<a href="${url}" mce_href="${url}" target="_blank">${text}</a><br/>', { text: "人肉搜索", url: "http://renro