不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
Dvbbs发贴时验证文件是否上传
编辑:dnawo 日期:2008-01-18
在Dvbbs中发贴时,文件的上传和贴子的发布是分开进行的(先传文件再发贴),这导致一些用户在发贴时文件选择了却没有上传,下边我们来修改下Js函数,在发贴前先验证下文件域是否为空,如果不为空则提示用户文件还未上传。
修改1:针对发贴和完整的回复模式。
打开"images/post/DhtmlEdit1.js"修改Checkpostdata函数(红色部分新增):
修改2:针对快速回复模式。登录后台"风格模板管理→分页面模板(dispbbs)→界面风格管理→template.html(0)",找到Js的Checkpostdata函数修改如下(红色部分新增):
上边代码在Dvbbs8.1.1中检测通过!
修改1:针对发贴和完整的回复模式。
打开"images/post/DhtmlEdit1.js"修改Checkpostdata函数(红色部分新增):
复制内容到剪贴板
程序代码

String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
function Checkpostdata(theform)
{
//检测文件是否上传
try{
if(frames["ad"].document.forms["form"].file1)
{
if((frames["ad"].document.forms["form"].file1.value).Trim() != "")
{
if(! confirm("文件还没有上传,确定不传吗?"))
{
frames["ad"].document.forms["form"].file1.focus();
return false;
}
}
}
}
catch(e){}
Dvbbs_CopyData('Body');
Checkdata();
if (ischeck==false)
{
return false;
}
else{
try{
if (typeof(ajaxpost) != "undefined")
return ajaxpost.postForm(theform);
else
return true;
}
catch (e){return true;}
}
}
function Checkpostdata(theform)
{
//检测文件是否上传
try{
if(frames["ad"].document.forms["form"].file1)
{
if((frames["ad"].document.forms["form"].file1.value).Trim() != "")
{
if(! confirm("文件还没有上传,确定不传吗?"))
{
frames["ad"].document.forms["form"].file1.focus();
return false;
}
}
}
}
catch(e){}
Dvbbs_CopyData('Body');
Checkdata();
if (ischeck==false)
{
return false;
}
else{
try{
if (typeof(ajaxpost) != "undefined")
return ajaxpost.postForm(theform);
else
return true;
}
catch (e){return true;}
}
}
修改2:针对快速回复模式。登录后台"风格模板管理→分页面模板(dispbbs)→界面风格管理→template.html(0)",找到Js的Checkpostdata函数修改如下(红色部分新增):
复制内容到剪贴板
程序代码

String.prototype.Trim=function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
function Checkpostdata(theform){
//检测文件是否上传
try{
if(frames["ad"].document.forms["form"].file1)
{
if((frames["ad"].document.forms["form"].file1.value).Trim() != "")
{
if(! confirm("文件还没有上传,确定不传吗?"))
{
frames["ad"].document.forms["form"].file1.focus();
return false;
}
}
}
}
catch(e){}
Dvbbs_CopyData('Body');
var Dvbbs_bIsIE5=document.all;
var Dvbbs_Mode = 0;
if (Dvbbs_bIsIE5){
var IframeID=frames["Dvbbs_Composition"];
}
else{
var IframeID=document.getElementById("Dvbbs_Composition").contentWindow;
var Dvbbs_bIsNC=true;
}
if (theform.codestr!=null){
if (theform.codestr.value==''){
document.getElementById('errinfo').innerHTML='<li><font color="red">你忘记输入验证码了!</font></li>';
theform.codestr.focus();
return false;
}
}
if (theform.Body.value.length==0){
document.getElementById('errinfo').innerHTML='<li><font color="red">你忘记填写回复内容了!</font></li>';
IframeID.focus();
return false;
}else{
if (theform.Body.value.length <xsl:value-of select="'>'" disable-output-escaping="yes"/> <xsl:value-of select="post/setting/@maxpostlen"/>) {
document.getElementById('errinfo').innerHTML='<li><font color="red">回复内容不能大于 <xsl:value-of select="post/setting/@maxpostlen"/> 字节!</font></li>';
IframeID.focus();
return false;
}
if (theform.Body.value.length <xsl:value-of select="'<'" disable-output-escaping="yes"/> <xsl:value-of select="post/setting/@leastpostlen"/>) {
document.getElementById('errinfo').innerHTML='<li><font color="red">回复内容不能小于 <xsl:value-of select="post/setting/@leastpostlen"/> 字节!</font></li>';
IframeID.focus();
return false;
}
}
return ajaxpost.postForm(theform);
}
function Checkpostdata(theform){
//检测文件是否上传
try{
if(frames["ad"].document.forms["form"].file1)
{
if((frames["ad"].document.forms["form"].file1.value).Trim() != "")
{
if(! confirm("文件还没有上传,确定不传吗?"))
{
frames["ad"].document.forms["form"].file1.focus();
return false;
}
}
}
}
catch(e){}
Dvbbs_CopyData('Body');
var Dvbbs_bIsIE5=document.all;
var Dvbbs_Mode = 0;
if (Dvbbs_bIsIE5){
var IframeID=frames["Dvbbs_Composition"];
}
else{
var IframeID=document.getElementById("Dvbbs_Composition").contentWindow;
var Dvbbs_bIsNC=true;
}
if (theform.codestr!=null){
if (theform.codestr.value==''){
document.getElementById('errinfo').innerHTML='<li><font color="red">你忘记输入验证码了!</font></li>';
theform.codestr.focus();
return false;
}
}
if (theform.Body.value.length==0){
document.getElementById('errinfo').innerHTML='<li><font color="red">你忘记填写回复内容了!</font></li>';
IframeID.focus();
return false;
}else{
if (theform.Body.value.length <xsl:value-of select="'>'" disable-output-escaping="yes"/> <xsl:value-of select="post/setting/@maxpostlen"/>) {
document.getElementById('errinfo').innerHTML='<li><font color="red">回复内容不能大于 <xsl:value-of select="post/setting/@maxpostlen"/> 字节!</font></li>';
IframeID.focus();
return false;
}
if (theform.Body.value.length <xsl:value-of select="'<'" disable-output-escaping="yes"/> <xsl:value-of select="post/setting/@leastpostlen"/>) {
document.getElementById('errinfo').innerHTML='<li><font color="red">回复内容不能小于 <xsl:value-of select="post/setting/@leastpostlen"/> 字节!</font></li>';
IframeID.focus();
return false;
}
}
return ajaxpost.postForm(theform);
}
上边代码在Dvbbs8.1.1中检测通过!
评论: 0 | 引用: 0 | 查看次数: 5333
发表评论
请登录后再发表评论!