zoukankan      html  css  js  c++  java
  • JavaScript 四种显示数据方式

    <!doctype html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>JavaScript 显示数据</title>
        <style type="text/css">
            p{
                background-color: yellow;
            }
        </style>
        <script>
    
            window.onload=function () {
                // 方式1:使用window.alert()弹出警告框
                alert('hello,My name is Apollo !');
    
    
                // 方式2:使用document.write()方法将内容写到HTML文档中
                // document.write('hello,My name is Apollo !');
    
    
                // 方式3:使用innerHtml方法写入到Html元素中去
                // 1.JS入口函数有一个覆盖现象,假如你不注释上面document.write()相关代码,下面代码是看不见的.
                // 2.使用getElementsByTagName必修要加上索引,因为p标签很多,你这样得到的是一个数组
                // document.getElementsByTagName('p')(0).innerHTML='hello,My name is Apollo !!!';
    
    
                // 方式4使用console.log()控制台输出
                console.log('hello,My name is Apollo !');
            }
    
        </script>
    </head>
    <body>
        <div>
            <p>这里的代码将会被替换......</p>
            <p>这里是第二个p标签</p>
        </div>
    </body>
    </html>
  • 相关阅读:
    inndb 刷脏页
    mysql 创建索引
    mysql 索引异常:
    mysql change buffer
    mysql 事务
    mysql 全局锁和表锁
    mysql 索引优化
    mysql innoDB使用b+树作为索引
    mysql 中redo log bin log
    mysql 隔离级别
  • 原文地址:https://www.cnblogs.com/apollo1616/p/9814346.html
Copyright © 2011-2022 走看看