zoukankan      html  css  js  c++  java
  • 变量和字符串的区别

     1 <!DOCTYPE html>
     2 <html>
     3 <head>
     4 <meta charset="utf-8">
     5 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
     6 <title>练习</title>
     7 <style type="text/css">
     8 #box{width: 300px;height: 300px;background: yellow;margin:10px auto;}    
     9 </style>
    10 </head>
    11 <body>
    12     <input type="button" value="点击" onclick="alert('1')";>
    13     <input type="button" value="点击2" onclick="alert(2)";>
    14     <input type="button" value="点击3" onclick="alert(1+2)";>
    15     <input type="button" value="点击4" onclick="alert('1'+'2')";>
    16     <input type="button" value="点击5" onclick="alert('1'+2)";>
    17     
    18     <input type="button" value="点击6" onclick="alert(我)";>
    19     <input type="button" value="点击7" onclick="alert('我')";>
    20 </body>
    21 </html>

    alert中带引号的是字符串,不带引号的是变量,变量必须先定义,所以,不带引号的我,将无法弹出来

    衣带渐宽终不悔,为伊消得人憔悴,憔悴半天也没用,还是努力起来人富贵
  • 相关阅读:
    VUE入门
    搭建内网穿透服务
    nacos集群配置安装
    jenkins入门
    Linux系统管理与自动化运维
    SVN
    JAR包启动
    服务器rm -rf 恢复案例 好文章
    docker入门到放弃
    CentOS7安装图形界面及报错处理
  • 原文地址:https://www.cnblogs.com/zhangjingyun/p/4662216.html
Copyright © 2011-2022 走看看