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>


查看全文
  • 相关阅读:
    Android UI--自定义ListView(实现下拉刷新+加载更多)
    12306火车票订票网站的一个Bug
    golang中赋值string到array
    Node.js学习(14)----EJS模板引擎
    操作系统
    springMVC学习笔记--初识springMVC
    sqlplus 连接数据库报错SP2-0642: SQL*Plus internal error state 2130, context 0:0:0
    对于事务和同步(并发)的简要理解
    Jsoup入门
    [LeetCode]Single Number
  • 原文地址:https://www.cnblogs.com/ldxsuanfa/p/10927015.html
  • Copyright © 2011-2022 走看看