Home > Backend Development > PHP Tutorial > PHP变量赋值、代入给JavaScript中的变量_php实例

PHP变量赋值、代入给JavaScript中的变量_php实例

WBOY
Release: 2016-06-07 17:12:24
Original
876 people have browsed it

复制代码 代码如下:

$(document).ready(function(){

   
    var t=;
    alert(t)   
})


复制代码 代码如下:

$(document).ready(function(){

   
    var t="";
    alert(t)   
})



复制代码 代码如下:


关键是sd两旁既要加单引号还要加上引号否则就会显示
“sd is not defined
[在此错误处中断]    
var t=sd;”
sd不加引号即为一个变量,之前没定义过该变量,就把他赋值给别的变量,当然会报错

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