Home > php教程 > php手册 > body text

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

WBOY
Release: 2016-06-13 08:59:32
Original
1174 people have browsed it

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

复制代码 代码如下:
$(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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template