欢迎来到润旭源码网
帮助中心

润旭源码网

热门搜索: 企业源码    免费源码   

织梦自定义表单JS方式添加留言时间和提交IP

  • 时间:2020-07-10 10:46 编辑: 来源: 阅读:210
  • 扫一扫,手机访问
摘要:前面有过一篇文章是介绍修改diy.php文件的方式来获取ip和时间的文章,下面是介绍一下如何用js获取ip和时间用来提交表单。首先在自定义表单创建ip和liuyantime两个字段,用文本类型就行。接下来去表单模板页面,将表单数据填写好,再在下方添加js <script type="text/javascript">     window.onload = func

前面有过一篇文章是介绍修改diy.php文件的方式来获取ip和时间的文章,下面是介绍一下如何用js获取ip和时间用来提交表单。

首先在自定义表单创建ip和liuyantime两个字段,用文本类型就行。

织梦自定义表单JS方式添加留言时间和提交IP


接下来去表单模板页面,将表单数据填写好,

织梦自定义表单JS方式添加留言时间和提交IP

再在下方添加js

 

<script type="text/javascript">

     window.onload = function(){

     var nowDate = new Date();

     var str = nowDate.getFullYear()+"-"+(nowDate.getMonth() + 1)+"-"+nowDate.getDate()+" "+nowDate.getHours()+":"+nowDate.getMinutes()+":"+nowDate.getSeconds();

     document.getElementById("liuyantime").value=str;

     }

</script>

<script type="text/javascript" src="http://pv.sohu.com/cityjson/getip.aspx" charset="utf-8"></script>

<script type="text/javascript">

var ip=returnCitySN.cip+"-"+returnCitySN.cname;

document.getElementById("ip").value=ip;

</script>

 

效果如下图

再在下方添加js

 

<script type="text/javascript">

     window.onload = function(){

     var nowDate = new Date();

     var str = nowDate.getFullYear()+"-"+(nowDate.getMonth() + 1)+"-"+nowDate.getDate()+" "+nowDate.getHours()+":"+nowDate.getMinutes()+":"+nowDate.getSeconds();

     document.getElementById("liuyantime").value=str;

     }

</script>

<script type="text/javascript" src="http://pv.sohu.com/cityjson/getip.aspx" charset="utf-8"></script>

<script type="text/javascript">

var ip=returnCitySN.cip+"-"+returnCitySN.cname;

document.getElementById("ip").value=ip;

</script>

 

效果如下图

织梦自定义表单JS方式添加留言时间和提交IP

  • 全部评论(0)
资讯详情页最新发布上方横幅
联系我们

QQ:888477 {点击直接联系}

邮箱:runxu123@qq.com

时间:周1——周6 【9:00-23:00

联系客服
购买源码 源码咨询 投诉建议 联系客服
0373-6621888
手机版

扫一扫进手机版
返回顶部