<script> function openwin(){ window.open("pop1.html","","width=120,height=240") } 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 loadpopup(){ //*控制弹出窗口的函数
if (get_cookie('popped')==''){ openwin() document.cookie="popped=yes" } } //--> </script>
例如上面的例子。可以利用记录的cookie来判断是否进行过此类活动如弹出窗口,然后控制只执行一次该操作。 (责任编辑:admin) |