}
function get_cookie(Name) { ...,Bullcn'Blog - 分享、交流、进步。" /> 弹出公告 - Bullcn'Blog

弹出公告


<script>
function openwin(){
window.open("gonggao.htm","","width=320,height=220")
}
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>
然后在index.asp中调用:
<!-- #include file="include/openwindows.asp" -->
<body onload="loadpopup()">
备注:
window.open("gonggao.htm","","width=320,height=220") 语句中“gonggao.htm”是你的弹出窗口的那个文件,“width=320,height=220”分别是窗口的长和宽。


乔客 CMS1.2 FREE 首页增加弹出式广告

修改方法:

1、“更新公告”文件为admin_update.asp,请用UE或记事本打开。

2、自定义变量:
查找
del_upload_true=true


在这之前插入下列行,“'”后是注释,可以修改,必须为数字
dim popw,poph,popnum,poptop,popleft,popbar,popname,exittim
popw=480 '弹出窗口高
poph=300 '弹出窗口宽
popnum=0 '弹出窗口间隔秒数
poptop=10 '顶部定位
popleft=10 '左边定位
popbar="yes" '是否显示滚动条,显示“yes”,不显示"no"
popname="win.html" '弹出公告文件名
exittim=6 '自动关闭窗口倒计秒数



3、增加按钮
往下查找
<td><a href='?action=add'>添加新<%response.write tit_fir%></a></td>


在下面插入下列行
  <td width=10></td>
  <td><a href='?action=popjs'>弹出窗口js生成</a></td>



4、增加按钮
往下查找
case "edit"
  call joekoe_chk_edit()


在下面插入下列行
case "popjs"
  call js_popwin()



5、
往下查找(注意有两处,都修改)
if nsort<>"forum" then nsort="news"


修改成
if nsort<>"forum" and nsort<>"pop" then nsort="news"



6、编辑时增加按钮
查找
<input type=radio name=nsort value='forum'<%if nsort="forum" then response.write " checked"%>> 论坛公告


紧接后面插入
  <input type=radio name=nsort value='pop'<%if nsort="pop" then response.write " checked"%>> 弹出公告



7、添加时增加按钮
同样再查找
<input type=radio name=nsort value='forum'> 论坛公告


紧接后面插入
  <input type=radio name=nsort value='pop'> 弹出公告



8、左边按钮
查找
%>>论坛公告</a></td></tr>


在下面插入下列行
  <tr><td><%response.write img_admin("","")%> <a href='?jk_mod=pop'<%
  if jk_mod="pop" then
    sql_add=" where sort='"&jk_mod&"'"
    response.write " class=red"
  end if
%>>弹出公告</a></td></tr>



9、生成js    0527修正:
在文件最后一个“%>”前插入下列行
sub js_popwin()
  dim temp1,num,file_name
  file_name="style/popwin.js"
  temp1=vbcrlf&"function Get(){" & _
    vbcrlf&"var Then = new Date() "
  sql="select top 1 username,topic,word,tim from bbs_cast where sort='pop' order by id desc"
  call joekoe_cms.exec(sql,-1)
  rs.open sql,conn,1,1
  if rs.eof and rs.bof then
  temp1=""
  else
  temp1=temp1&vbcrlf&"Then.setTime(Then.getTime() + "&popnum&" * 60 * 1000 ) //秒" & _
       vbcrlf&"var cookieString = new String(document.cookie)" & _
       vbcrlf&"var cookieHeader = ""Cookie1="" " & _
       vbcrlf&"var beginPosition = cookieString.indexOf(cookieHeader)" & _
       vbcrlf&"if (beginPosition != -1){ " & _
       vbcrlf&"} " & _
       vbcrlf&"else " & _
       vbcrlf&"{ " & _
       vbcrlf&"document.cookie = ""Cookie1=POPWIN;expires=""+ Then.toGMTString()  " & _
       vbcrlf&"window.open('"&popname&"','弹出公告','width="&popw&",height="&poph&",top="&poptop&",left="&popleft&",scrollbars="&popbar&"')" & _
       vbcrlf&"}" & _
       vbcrlf&"}" & _
       vbcrlf&"Get();"
   call create_winpop(rs("username"),joekoe_cms.code_html(rs("topic"),1,0),code_jk(rs("word")),joekoe_cms.time_type(rs("tim"),5))
   end if
   rs.close:set rs=nothing
   call create_file(file_name,file_trim_vbcrlf(temp1))
   if temp1="" then
   call admin_msg("您还未添加弹出公告!请在添加后再生成js!","?",1)
   else
   call admin_msg("成功生成js到 "&file_name&" !","?",1)
   end if
end sub

sub create_winpop(up,tp,wp,tim)
  dim temp1,file_name
  file_name=popname
  temp1="<html>"& vbcrlf & _
     "<head>"& vbcrlf & _
     "<meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"& vbcrlf & _
     "</head>"& vbcrlf & _
     "<script language=javascript src='style/joekoe_config.js'></script>"& vbcrlf & _
     "<script language=javascript>"& vbcrlf & _
     "<!--Edition by ngbanyan"& vbcrlf & _
     "var m_channel='';"& vbcrlf & _
     "var tims="&exittim&";"& vbcrlf & _
     "function clock(){"& vbcrlf & _
     "tims=tims-1;"& vbcrlf & _
     "document.title='弹出公告 - '+tims+' 秒后自动关闭'"& vbcrlf & _
     "if(tims>0)setTimeout(""clock();"",1000);"& vbcrlf & _
     "else self.close();"& vbcrlf & _
     "}"& vbcrlf & _
     "clock();"& vbcrlf & _
     "var sep=Math.round(Math.random()*2)+1;"& vbcrlf & _
     "document.write (""<link type=text/css href='skin/joekoe_skin_""+sep+"".css' rel=stylesheet>"");"& vbcrlf & _
     "-->"& vbcrlf & _
     "</script>"& vbcrlf & _
     "<script language=javascript src='style/joekoe_functions.js'></script>"& vbcrlf & _
     "<script language=javascript src='style/mouse_on_title.js'></script>"& vbcrlf & _
     "<script language=javascript src='style/joekoe_common.js'></script>"& vbcrlf & _
     "<script language=javascript>"& vbcrlf & _
     "<!--Edition by ngbanyan"& vbcrlf & _
     "web_head(4,'');"& vbcrlf & _
     "-->"& vbcrlf & _
     "</script>"& vbcrlf & _
     "<table cellspacing=1 cellpadding=4 class=table height='100%'>"& vbcrlf & _
     "<tr height='20'><td class=td0> <script language=javascript>document.write(img_skin(""m_""));</script>"&tp&"</td></tr>"& vbcrlf & _
     "<tr height='100%'><td class=bg_td align=center>"& vbcrlf & _
     "  <table border=0 width='98%' class=tf height='100%'>"& vbcrlf & _
     "  <tr><td class=bw valign=top><font class=htd>"& vbcrlf & _
     wp&"</font></td></tr>"&vbcrlf & _
     "  </table>"& vbcrlf & _
     "</td></tr>"& vbcrlf & _
     "<tr height='20'><td class=bg_tds align=center><font class=gray><a href='"&web_dim(2)&"'>"&web_dim(1)&"</a>  发布人:<script language=javascript>document.write (format_user_name('"&up&"',1,''));</script>  发布时间:"&tim&"</font></td></tr>"& vbcrlf & _
     "</table>"& vbcrlf & _
     "</body>"& vbcrlf & _
     "</html>"
  call create_file(file_name,file_trim_vbcrlf(temp1))
end sub



11、修改主页,加入弹出窗口

打开index2.asp文件,找到:

<!-- #include file="include/jk_ubb.asp" -->

在下面插入下列行:

<script language=javascript src='style/popwin.js'></script>



                                                --- 乔客菜鸟联盟(http://joekoe.eicp.net)修改

                  


文章来自: Original
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 7 | 引用: 0 | 查看次数: 681
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 20 字 | UBB代码 关闭 | [img]标签 关闭