• 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>

  • 相关阅读:
    fabric 网络操作中遇到的问题
    springBoot项目启动初始化数据
    行为验证码AJ-Captcha
    RestControllerAdvice注解无效问题
    记录美团一面问题
    关于springMVC
    作业08-集合
    选择排序
    Centos7 使用Minikube搭建Kubernetes集群
    Vscode 配置 Go语言插件
  • 原文地址:https://www.cnblogs.com/wleaves/p/4166543.html
Copyright © 2020-2023  润新知