zoukankan      html  css  js  c++  java
  • javascript 使用方式

    版权声明:本文为博主原创文章,未经博主同意不得转载。

    https://blog.csdn.net/qilixiang012/article/details/26688393

    第一种:内嵌在html节点中

    <html>
    <body>
    
    <input type="button" onclick="document.body.style.backgroundColor='lavender';"
    value="Change background color" />
    
    </body>
    </html>


    另外一种:调用方法

    <html>
    <body>
    
    <script>
    function ChangeBackground()
    {
    document.body.style.backgroundColor="lavender";
    }
    </script>
    
    <input type="button" onclick="ChangeBackground()"
    value="Change background color" />
    
    </body>
    </html>

    第三种:导入js文件

     <script src=“url” type="text/javascript"></script>


查看全文
  • 相关阅读:
    nginx.conf中配置laravel框架站点
    centos6.4下安装php7+nginx+mariadb环境
    Windows Terminal 安装和运行
    微软 WSL 重装操作系统
    Pulumi 如何在 Windows 环境中设置
    Ubuntu 20.04 安装 JDK
    代码的 Lint 是什么意思
    CentOS 8 手动安装 Go 1.16 版本
    Raspberry Pi 安装 go 后提示错误 Exec format error
    系统管理--查看网卡、内存等
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10927015.html
  • Copyright © 2011-2022 走看看