-1、 equation ax^2+bx+c=0, The root of quadratic equation of one variable .

Explain ：

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> Untitled Document </title>

<body>
<input type="number" id="n1" placeholder=" Input a value "/>
<input type="number" id="n2" placeholder=" Input b value "/>
<input type="number" id="n3" placeholder=" Input c value "/>
<input type="button" value=" Confirm the function value " onclick="ABC()" />      //onclick Reference function ABC
</body>
</html>
<script>
function ABC()                                                                      // Set function
{
var a=document.getElementById("n1").value
var b=document.getElementById("n2").value
var c=document.getElementById("n3").value
if(a!=""&&b!=""&&c!="")
{
var d=(b*b-4*a*c)
if(a!=0)
{
if(d>0)
{
alert(" There are two roots "+(-b+Math.sqrt(d))/(2*a)+" and "+(-b-Math.sqrt(d))/(2*a))
}
else
{
if(d==0)
{
alert(" There is a real root for "+(-b)/(2*a))
}
else
{
}
}
}

else
{
alert(" It's not a quadratic equation of two variables , There is a root for "+(-c)/b)
}

}
else
{
}
}
</script>

2、 Enter year 、 month 、 And output the date format

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>year、month、day</title>

<body>
</body>
</html>
<script>
var year=prompt(" Please enter the year ")
if(year!=null)                       // Press the OK button
{
var number=isNaN(year)      // Judge year Is it a numerical value , It's the number. false, Not numbers true
if(number==false)
{
if(year>0&&year<=9999&&year%1==0)
{
var month=prompt(" Please enter the month ")
if(month!=null)
{
var number1=isNaN(month)
if(number1==false)
{
if(month>0&&month<=12&&month%1==0)
{
var day=prompt(" Please enter the date ")
if(day!=null)
{
var number2=isNaN(day)
if(number2==false)
{
if(day>0&&day<=31&&day%1==0)
{
if(month==1||month==3||month==5||month==7||month==8||month==10||month==12)
{
alert(year+" year "+month+" month "+day+" Japan ")
}
else if(month==4||month==6||month==9||month==11)
{
if(day>0&&day<=30)
{
alert(year+" year "+month+" month "+day+" Japan ")
}
else
{
}
}
else if(month==2)
{
if(year%4==0&&year%100!=0||yeas%400==0)
{
if(day>0&&day<=29)
{
alert(year+" year "+month+" month "+day+" Japan ")
}
else
{
}
}
else
{
if(day>0&&day<=28)

{
alert(year+" year "+month+" month "+day+" Japan ")
}
else
{
}
}
}
}
else
{
alert(" You have not entered a valid date ")
}
}
else
{
alert(" The date you entered is wrong ")
}
}
}
else
{
alert(" You have not entered a valid month ")
}
}
else
{
alert(" The month you entered is wrong ")
}
}
}
else
{
alert(" You have not entered the correct year ")
}
}
else
{
}
}
</script>

3、 Do you run faster than a leopard ？

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> Untitled Document </title>

<body>
Can you run past a leopard <input type="text" id="use" placeholder=" Can you run past a leopard " />
<input type="button" value=" Click ok " onclick="a()" />
</body>
</html>
<script>
function a()
{
var on=document.getElementById("use").value;
if(on==" can ")
{
alert(" You are more than a beast ")
}
else
{
if(on==" You can't ")
{
alert(" Even animals are inferior to ")
}
else
{
}
}
}
</script>

## JavaScript- More related articles on branch sentence practice

1. JavaScript Branch statement if, else if, switch Case explanation

if Sentence is mainly in need of judgment , Or a statement to use when you know how many situations there are .A==B?"A be equal to B";"A It's not equal to B"; The basic structure :           if( Judge the condition ){ ...

2. JavaScript Basics 4—— About statement flow control （ Branch statement 、 Loop statement, etc ）

Branch statement (1)if...else... sentence , There are three basic formats , as follows <script type="text/javascript"> var i=50; //if sentence i ...

3. JavaScript grammar 、 Dialog box . Branch statement

One . usage It's in three places ,1.head Inside  2.body Inside  3.</html> after   It's usually written in </html> after Its use for <script></scr ...

4. HTML Basics --JS brief introduction 、 Basic grammar 、 Type conversion 、 Variable 、 Operator 、 Branch statement 、 Loop statement 、 Array 、 function 、 Function call .avi

JS brief introduction 1.JavaScript What is it ? It's a scripting language , A host file is required , Its host file is HTML file . 2. It is associated with Java What is the relationship ? There's no direct connection ,Java yes Sun company ( Has been Oracle closed ...

5. js brief introduction 、 Basic grammar 、 Type conversion 、 Variable 、 Operator 、 Branch statement 、 Loop statement 、 function 、 Function call

javascript It's a scripting language , A host file is required , His host file is html file . Three common dialog boxes alert("") Warning dialog , A warning dialog box pops up <script> al ...

6. Learn from the beginning JavaScript ( 6、 ... and )—— sentence

original text : Learn from the beginning JavaScript ( 6、 ... and )-- sentence One . Conditional branch statement :if The basic format : if (< expression 1>){    < Statement group 1>}else if (< expression 2> ...

7. JavaScript The sentence of , loop

JavaScript There are three main types of sentences : The order , Branch , loop . 1. Sequential statements : Follow the sequence , The most common sentence , I won't go into more details here . Its structure is as follows 2. Branch statement : Judge according to the conditions , Different results execute different statements . Its ...

8. JavaScript Conditional statements 4-- Branch statement --if

JavaScript Conditional statements -- Branch statement Learning goals 1. Master conditional sentences if 2. master prompt() Application 3. master alert Application If sentence Grammar 1 : If(condition){ statement ...

9. JavaScript Common sentences

JavaScript Common sentences sentence grammar explain Simple sentences : Statement to : The semicolon ends Sentence block {} Put a group of sentences into idiom blocks ,ES There is no statement block scope in , It can also be used as an object literal Add tag statement label Tag the code ...

10. JS Basics _ Conditional branch statement ：switch sentence

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

## Random recommendation

1. PHP in MySQL operation

Used this time demo yes MySQL Sample database for employees, Click on the download address , Notice when importing , stay employees.sql In file , take source Change to your current directory . PHP Medium demo The code can be in ideo ...

2. Redux Explore and asynchronous data flow

Basic cognition Post one first redux The basic structure of Original from <UNIDIRECTIONAL USER INTERFACE ARCHITECTURES> In this picture , We can see clearly that ,view middle class ...

3. PHPStorm+Wamp+Xdebug+Windows7 Debugging code

Wamp Integrated environment PHPStorm+Xdebug Debugging code 2013.04.16 It took two hours to finally , Configuration worked ! My development environment is as follows , Other environments can also refer to my configuration development environment : Windo ...

4. Android Source analysis of Framework Layer upgrade （ window 、 The system starts ）

5. java double The type retains two decimal places 4 Methods 【 turn 】

4 Methods , It's all rounded , example : import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberF ...

6. pouchdb sync

PouchDB and CouchDB were designed for one main purpose: sync. Jason Smith has a great quote about th ...

7. dede The first page calls the single page -&gt; Column content

{dede:sql sql='Select content from dede_arctype where id=47'} [field:content/] {/dede:sql}

8. About Repeater Use in DorpWownList The problem of

About Repeater Use in DorpWownList The problem of The front desk : <asp:Repeater ID="Repeater1" runat="server" ...

9. choice 29 Partially useful jQuery Application plug-ins （ Free point download ）