代码改变世界

随笔分类 -  JavaScript

javascript清空网页代码防止查看源代码

2012-01-16 14:25 by Alaric, 206 阅读, 收藏,
摘要: javascript清空网页代码防止查看源代码<html> <head> <script language="javascript"> function clear(){ Source=document.body.firstChild.data; document.open(); document.close(); document.title="看不到源代码"; document.body.innerHTML=Source; } </script> </head> <body onloa 阅读全文

js获取 request值

2012-01-11 17:32 by Alaric, 281 阅读, 收藏,
摘要: js获取 request值 function getUrlParam(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; }使用方法路径?id='+getUrlParam('id') 阅读全文