5, Web page production of Dreamweaver (JS preliminary application)

Source: Internet
Author: User

Javascript

* can be read on the head (first read the head)

The page is automatically refreshed when the form is submitted, preferably turned off

Writing:

1. Output

<script>

document.write ("Hello World");

</script>

2. Button Application

<input name= "alert" value= "alert" type= "button" onclick= ' Alert ("This is the trigger event") '/>

3. Define variables and output

var Bianliang;

Bianliang= "123";

document.write (Bianliang);

4. Changing the attributes of an element

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

<script>

function Hello ()

{

X=document.getelementbyid ("Hello")

X.style.color = "#ff0000";

}

</script>

<input type= "button" value= "Click to change Color" onclick= "hello ()"/>

<!--click From Black to red--

5 , Item index, indicating the first N an element that appears, with the Getelementsbyname simultaneous use

Define a set of variables

var student =

{

Name: " Zhang San ",

Sex: " male "

};

student.name= " Zhang San ";

document.write (Student.name);

( * print "Zhang San")

External calls JS

<script src= "" ></script>

5, Web page production of Dreamweaver (JS preliminary application)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.