私人领地

js只弹窗一次

 

<script>
var alertmessage="检测到您当前浏览器为IE8或以下版本,建议您使用IE9或以上版本,或者火狐、谷歌浏览器,才能体验到最佳效果"
var once_per_session=1
function get_cookie(Name) {
  var search = Name + "="
  var returnvalue = "";
  if (document.cookie.length > 0) {
    offset = document.cookie.indexOf(search)
    if (offset != -1) {
      offset += search.length
      end = document.cookie.indexOf(";", offset);
      if (end == -1)
         end = document.cookie.length;
      returnvalue=unescape(document.cookie.substring(offset, end))
      }
   }
  return returnvalue;
}
function alertornot(){
if (get_cookie('alerted')==''){
loadalert()
document.cookie="alerted=yes"
}
}
function loadalert(){
alert(alertmessage)
}
if (once_per_session==0)
loadalert()
else
alertornot()
</script>

 

posted @ 2016-04-01 11:02  狂奔的蜗牛Snails  阅读(1108)  评论(0编辑  收藏  举报