zoukankan      html  css  js  c++  java
  • 5、网页制作Dreamweaver(JS的初步运用)

    JAVASCRIPT

    *放在头部也可以读取(最先读取头部)

    表单提交时会自动刷新网页,最好关掉

    写法:

    1、输出

    <script>

                       document.write("hello world");

    </script>

    2、按钮运用

    <input name="alert" value="alert"type="button" onclick='alert("这是触发事件")'/>

    3、定义变量并输出

        var bianliang;

             bianliang="123";

             document.write(bianliang);

    4、改变元素的属性

    <p id="hello">hello</p>

    <script>

             function hello()

             {

                       x=document.getElementById("hello")

                       x.style.color = "#ff0000";

             }

    </script>

    <input type="button" value="点击变颜色" onclick="hello()" />

    <!--点击由黑色变红色-->

    5item索引,指示第n个出现的元素,与getElementsByName同时使用

    定义一组变量

    var student =

             {

                       name:"张三",

                       sex:""

             };

             student.name="张三";

             document.write(student.name);

    *打印“张三”)

    外部调用JS

    <script src=””></script>

  • 相关阅读:
    hugo搭建个人博客
    docker安装mongo
    java+vue跨域每次请求获取不同session问题
    优雅的使用JdbcTemplate
    docker布署springcloud无法使用feign通信
    xxl-job不兼容graylog解决方案
    Springboot集成graylog
    Springboot集成swagger和knife
    Springboot集成xxl-Job
    Springboot中redisTemplate乱码或json转换问题
  • 原文地址:https://www.cnblogs.com/wleaves/p/4166543.html
Copyright © 2011-2022 走看看