javascript手冊-a[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 longj 的 blog

abs method

returns the absolute value of a number.

语法

math.abs(number)

number is any numeric expression or a property of an existing object.

用法

math

例子

in the following example, the user enters a number in the first text box and presses the calculate button to display the absolute value of the number.

<form>
<p>enter a number:
<input type="text" name="absentry">

<p>the absolute value is:
<input type="text" name="result">

<p>
<input type="button" value="calculate"
   onclick="form.result.value = math.abs(form.absentry.value)">

</form>

acos method

returns the arc cosine (in radians) of a number.

语法

math.acos(number)

number is a numeric expression between -1 and 1, or a property of an existing object.

用法

math

描述

the acos method returns a numeric value between 0 and pi radians. if the value of number is outside the suggested range, the return value is always 0.

例子

// displays the value 0
document.write("the arc cosine of 1 is " + math.acos(1))

// displays the value 3.141592653589793
document.write("<p>the arc cosine of -1 is " + math.acos(-1))

// displays the value 0
document.write("<p>the arc cosine of 2 is " + math.acos(2))

see also

  • asin, atan, cos, sin, tan methods

    action property

    a string specifying a destination url for form data that is submitted.

    语法

    formname.action

    formname is either the name of a form or an element in the forms array.

    property of

    form

    描述

    the action property is a reflection of the action attribute of the <form> tag. each section of a url contains different information. see the location object for a 描述 of the url components.

    you can set the action property at any time.

    certain values of the action property may require specific values for other form properties. see rfc 1867 for more information.

    例子

    the following example sets the action property of the musicform form to the value of the variable urlname:

    document.musicform.action=urlname

    see also

  • encoding, method, target properties

    alert method

    displ

  • 本文关键:javascript
      相关方案
    Google
     

    本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

    go top