Home > Web Front-end > JS Tutorial > body text

JavaScript syntax summary for newbies_basic knowledge

WBOY
Release: 2016-05-16 19:03:43
Original
1226 people have browsed it

Things that novices often learn when enrolling~

// Pop-up prompt

// Pop-up prompt // Read the system time
www.winshell.cn
//Click the link to run js to display the time

//Click the submit button to run the js to display the time
************************ **for loop****************************


****** *******************Calculator****************************







**** *********************if/elseDisplay comments based on scores***************


if/else display comments based on scores



Please Enter your results



<script>alert('badwolf测试!');</script> <script>alert('呵呵!');</script><script>alert(new Date());</script> <script> <BR> var badwolf_x=""; <BR> for(var x=1; x <= 100 ; x++) <BR> { <BR> badwolf_x=badwolf_x+"x="+x; <BR> } <BR> alert(badwolf_x); <BR></script>****************** *******if3**************** <script> <BR> function get_sum() <BR> { <BR> var x=parseFloat(document.jisuanqi.no1.value); <BR> var y=parseFloat(document.jisuanqi.no2.value); <BR> var sum=x+y; <BR> alert(sum); <BR> // return sum; <BR> } <BR></script><script> <BR> function dd() <BR> { <BR> var aa=document.form1.chengji.value; <BR> if(aa<=100 && aa>90) <BR> { <BR> alert("成绩优秀"); <BR> } <BR> else if(aa<=90 && aa>75) <BR> { <BR> alert("成绩中等"); <BR> } <BR> else if(aa<=75 && aa>=60) <BR> { <BR> alert("及格"); <BR> } <BR> else if(aa<60 && aa>=0) <BR> { <BR> alert("不及格"); <BR> } <BR> else <BR> { <BR> alert("你傻啊~~~!!你输入的是成绩么????"); <BR> } <BR> } <BR> </script> <script> <BR> var x=10; <BR> var y=-4; <BR> if(x>20) <BR> { <BR> if(y>0) <BR> { <BR> alert(x+y); <BR> } <BR> else <BR> { <BR> alert(x-y); <BR> } <BR> } <BR> else <BR> { <BR> alert('猪'); <BR> } <BR></script>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template