The base base of JavaScript (core syntax, debugging, Functions,)

Source: Internet
Author: User

HTML: Hypertext Markup Language

CSS: Structured cascading styles

selector {

Property Name: property value;

}

javascript: Interaction/Effects

On-Machine Exercise 1

vararray=["America", "Greece", "Britain", "Canada", "China", "Egypt";

var count=0;

for (var i in array) {

if (Array[i].indexof ("a") >-1| | Array[i].indexof ("A") >-1) {

count++;

}

}

document.write ("The characters containing A or a are:" +count);

On-Machine Exercise 3

<! DOCTYPE html>

<meta charset= "UTF-8" >

<title> Greet by Time </title>

<script type= "Text/javascript" >

function Jisuan () {

var op1=prompt (' Please enter the first number: ');

var op2=prompt (' Please enter a second number: ');

var pex=prompt (' Please enter operation symbol: ');

Op1=parseint (OP1);//String converted to an integer

Op2=parseint (OP2);

Switch (PEX) {

Case ' + ':

Alert ("Two number operation result:" +op1+pex+op2+ "=" + (OP1+OP2) ");

Break

Case '-':

Alert ("Two number operation result:" +op1+pex+op2+ "=" + (OP1-OP2) ");

Break

Case ' * ':

Alert ("Two number operation result:" +op1+pex+op2+ "=" + (OP1*OP2) ");

Break

Case '/':

Alert ("Two number operation result:" +op1+pex+op2+ "=" + (OP1/OP2) ");

Break

Case '% ':

Alert ("Two number operation result:" +op1+pex+op2+ "=" + (OP1%OP2) ");

Break

}

}

</script>

<body>

<input type= "button" value= "calculates the result of two number operation" onclick= "Jisuan ()"/>

</body>

The base base of JavaScript (core syntax, debugging, Functions,)

Related Article

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.