公共JS调用

文件说明:public.js

适用范围:全局

JS文件:

./tpl/static/js/public.js

JS函数:

函数名 描述 参数
addfavorite(url, title) 网站加入收藏夹 url:网站地址
title:网站名称
copy_url(id) 拷贝URL id:input ID
validIntval() 判断是否为整数 return bool
validFloat() 判断是否为浮点型 return bool
isMobile(mobile) 判断是否为中国手机号码 mobile:手机号码
return bool
isQQ(qq) 判断是否为QQ号码 qq:qq
return bool
initGetDownTime(mbinput, btnobj) 发送手机验证码倒计时 mbinput:手机号码input(ID)
btnobj:发送按钮button(ID)


文件说明:消息提醒框

适用范围:前台TPL,会员中心

JS文件:

./tpl/static/js/imbox.js

JS函数:

函数名 描述 参数
roll_imbox() 普通弹窗消息框 ~
loop_imbox(looptimer) 循环弹窗消息框 looptimer:间隔时间(毫秒)

调用实例:

<!--{if $login.status==0}-->
<!--{if $config.imbox_gueststatus == 1}-->
var imbox_title = "<!--{$config.imbox_title}-->";
var imbox_width = <!--{$config.imbox_width}-->;
var imbox_holdtimer = <!--{$config.imbox_holdtimer}-->;
<!--{if $config.imbox_loopstatus == 1}-->
$(function(){
setTimeout("loop_imbox(<!--{$config.imbox_looptimer}-->)", <!--{$config.imbox_loadtimer}-->*1000);
});
<!--{else}-->
$(function(){
setTimeout("roll_imbox()", <!--{$config.imbox_loadtimer}-->*1000);
});
<!--{/if}-->
<!--{/if}-->
<!--{else}-->
<!--{if $config.imbox_userstatus == 1}-->
var imbox_title = "<!--{$config.imbox_title}-->";
var imbox_width = <!--{$config.imbox_width}-->;
var imbox_holdtimer = <!--{$config.imbox_holdtimer}-->;
<!--{if $config.imbox_loopstatus == 1}-->
$(function(){
setTimeout("loop_imbox(<!--{$config.imbox_looptimer}-->)", <!--{$config.imbox_loadtimer}-->*1000);
});
<!--{else}-->
$(function(){
setTimeout("roll_imbox()", <!--{$config.imbox_loadtimer}-->*1000);
});
<!--{/if}-->
<!--{/if}-->
<!--{/if}-->


文件说明:主JS文件

适用范围:前台TPL,会员中心

JS文件:

./tpl/static/js/ajax.js

./tpl/static/js/ajax.roll.js

./tpl/static/js/jdbox.js

JS函数:

函数名 描述 是否弹窗 参数
ajax_email(inputid, tipsid, type) 检测邮箱是否存在 No inputid: 邮箱input框ID
tipsid: JSON返回信息的HTML提示ID
type:类型 all/null
ajax_user(inputid, tipsid) 检测用户名是否存在 No inputid: 用户名input框ID
tipsid: JSON返回信息的HTML提示ID
ajax_checkcode(inputid, tipsid) 检测验证码是否正确 No inputid: 验证码input框ID
tipsid: JSON返回信息的HTML提示ID
fetch_city(pname, cname, cvalue, text, ajax, dname, dvalue) 一级、二级地区下拉选框AJAX No pname 一级地区名
cname 二级地区名
cvalue 二级地区值
text 文字提示
ajax 是否调用ajax 三级地区
dname 三级地区名
dvalue 三级地区值
fetch_dist(cname, dname, dvalue, text) 三级地区下拉选框AJAX No cname 二级地区名
text 文字提示
dname 三级地区名
dvalue 三级地区值
update_hits(id, type, tipid) 更新浏览次数 No id:ID
type: 类型(频道)
tipid:JSON返回信息提示ID
ajax_listen(tuid, tipid, css) 加入关注 No tuid 对方ID
tipid JSON返回信息提示ID
css CSS样式
function ajax_dellisten(tuid, tipid, css) 取消关注 No tuid 对方ID
tipid JSON返回信息提示ID
css CSS样式
function ajax_black(tuid, tipid, css) 加入黑名单 No tuid 对方ID
tipid JSON返回信息提示ID
css CSS样式
setAvatar(img, x, y, w, h, pw, ph, cometype) 裁图 No img 图片地址
x 坐标x
y 坐标y
w 坐标w
h 坐标h
pw 图片宽
ph 图片高
cometype 来源(reg/cp)
ajax_visithome(homeuid) 访问空间记录 No homeuid:会员主页ID
ajax_getmbkey(mobile, tipid, button) 会员中心获取手机验证码 No mobile:手机号
tipid:JSON返回信息提示ID
button:按钮
ajax_getmbcode(mobile, tipid, button) 会员注册 获取手机验证码 No mobile:手机号
tipid:JSON返回信息提示ID
button:按钮ID
ajax_checkmbcode(mbinput, cdinput, tipsid) 检验 手机验证码是否输入正确 No mbinput:手机号input(ID)
cdinput:验证码input(ID)
tipsid:结果提示ID
ajax_home_sendsms(uid, content, type, tipid, button, returntype) 给会员发送手机短信 No uid:会员ID
content:短信内容
type:扣费类别 0-信使,1-金币
tipid:JSON返回信息提示ID
button:发送按钮
returntype:JSON返回类型(jdbox/null)
jbox_editpassword(width, height) 弹窗修改密码页 Yes width:页面宽(缺省)
height:页面高(缺省)
jbox_setstatus(width, height) 设置交友状态 Yes width:页面宽(缺省)
height:页面高(缺省)
jbox_album_upload(width, height) 上传相册 Yes width:页面宽(缺省)
height:页面高(缺省)
jbox_album_edit(id, width, height) 修改相册 Yes id:ID
width:页面宽(缺省)
height:页面高(缺省)
jbox_send_gift(touid, width, height) 赠送礼物 Yes touid:接收人ID
width:页面宽(缺省)
height:页面高(缺省)
jbox_complaint(uid, width, height) 举报投诉 Yes uid:会员ID
width:页面宽(缺省)
height:页面高(缺省)
jbox_hibox(touid, width, height) 打招呼 Yes touid:对方会员ID
width:页面宽(缺省)
height:页面高(缺省)
jbox_writebox(touid, width, height) 写信件 Yes touid:对方会员ID
width:页面宽(缺省)
height:页面高(缺省)
jbox_readbox(id, width, height) 阅读信件 Yes id:信件ID
width:页面宽(缺省)
height:页面高(缺省)
jbox_loginbox(width, height) 登录页 Yes width:页面宽(缺省)
height:页面高(缺省)
jbox_home_viewcontact(uid, width, height) 查看会员联系方式 Yes uid:会员ID
width:页面宽(缺省)
height:页面高(缺省)
jbox_home_viewalbum(uid, width, height) 查看会员相册 Yes uid:会员ID
width:页面宽(缺省)
height:页面高(缺省)
jbox_home_sms(uid, width, height) 发送手机短信页 Yes uid:会员ID
width:页面宽(缺省)
height:页面高(缺省)

调用实例:

弹窗登录框:
<!--{if $config.logintips_status == 1}-->
$(function(){
setTimeout("jbox_loginbox()", <!--{$config.logintips_loadtimer}-->*1000);
});

温馨提示:以上JS,需要jquery的支持,在调用以上文件之前必须包含以下文件:

<script type='text/javascript' src='<!--{$urlpath}-->tpl/static/js/jquery-1.6.4.min.js'></script>