JS怎么调用TP框架的代码{$v.}

WBOY
Release: 2016-06-23 13:18:29
Original
861 people have browsed it

<script> <br />function fresh() <br />{ <br /> var endtime= new Date(); <br /> var nowtime =new Date("{$v.date}"); 这里怎么调用的不对Date("{$v.date}"); <br /> <br /> var leftsecond=parseInt((endtime.getTime()-nowtime.getTime())/1000); <br /> <br /> d=parseInt(leftsecond/(3600*24)); <br /> h=parseInt((leftsecond/3600)%24); <br /> m=parseInt((leftsecond/60)%60); <br /> s=parseInt(leftsecond%60); <br /> <br />document.getElementById("times").innerHTML=d+'天'+h+"小时"+m+"分"+s+"秒"; <br />setTimeout(fresh,1000); <br /> <br />} <br />window.onload=fresh; <br /></script>


回复讨论(解决方案)

.........

{$v.date}  这个是从后台传过来的吧?可以这样$this->assign("date",time());
然后在js里   var  time="{$date}"
这个time就是传过来的当前时间

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!