插入js效果但是不出效果,我用{$user_name}判断的,是不能混着用么

WBOY
Release: 2016-06-23 13:52:59
Original
1027 people have browsed it

登录人为:{$user_name}
<script></script>
<script> <br /> $(document).ready(function(){ <br /> if({$user_name} !=null) <br /> {$("#login_null").hide();} <br /> } <br /> }); <br /> </script>

去掉if  效果就出来了 但是加上判断就不行。。上面我也打印了判断条件,也显示了 ,但是不能判断是因为神马


回复讨论(解决方案)

if({$user_name} !=null) 是错误的!变量未定义
if("{$user_name}" !=null) 要用引号括起来!

谢倒不必,这是常识
一个字母数字的组合
有引号括起时称作字符串
没有引号括起时称作变量
不能弄混淆了

Related labels:
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