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

PHP变量赋值、代入给JavaScript中的变量_PHP

WBOY
WBOYOriginal
2016-05-30 08:45:541154browse

代码如下:


$(document).ready(function(){

   
    var t=;
    alert(t)   
})


代码如下:


$(document).ready(function(){

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



代码如下:



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

Statement:
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