zoukankan      html  css  js  c++  java
  • 这知识点 稀碎 js

    document.getElementByid 用法

    语法:oElement = document .getElementById ( sID )

    参数:sID--必选项。字符串(String)

    返回值:oElement--对象(Element)

    说明:根据指定的id属性值得到对象。返回id属性值等于sID的第一个对象的引用。

    假如对应的为一组对象,则返回组对象中的第一个。如果无符合条件的对象,则返回null。

    注意: document.getElementById(" ") 得到的是一个对象,用 alert 显示得到的是“ object ”,而不是具体的值,它有 value 和 length 等属性,加上 .value 得到的才是具体的值!

    例:

    <html>
    <head>
    <title></title>
     <style type="text/css">
     body{ font-size :20px ; color:#4B0082;} 
    </style>
    <script language="javascript" type="text/javascript">
    function display_alert()
    {
    alert("提交成功"+"
    因为:"+document.getElementById("reason").value)
    }
    </script>
    </head> 
    <body>
    <div align="center">
    <form action=""method="get">
    我想说的话<textarea id="reason" cols="" rows=""></textarea> 
    <input type="submit"value="提交" onclick="display_alert()"/>
    </form>
    </div>
    </body>
    </html>
    View Code

     random()

    random()方法可返回介于0~1之间的一个随机数。

    语法 Math.random()

    返回值 double类型 0.1 ~1.0之间的一个伪随机数。

  • 相关阅读:
    HTML & CSS
    Python面向对象编程
    Python 内置函数
    Python函数
    三.python高级
    使用loadrunner编写webservice接口请求
    loadrunner中JavaVuser脚本的编写
    loadrunner 参数化取值方式详解
    loadrunner 参数化-如何从数据库中取数据-连接数据库进行参数化
    vmstat命令参数介绍
  • 原文地址:https://www.cnblogs.com/muanfeng/p/4414003.html
Copyright © 2011-2022 走看看