Academic Tutorials



English | French | Portugese | Dutch | Italian
Google

on-line

Haupt Quellenprogramme E-Bücher Downloads Mit uns in Verbindung treten Über uns

HTML Tutorials
HTML Tutorial
XHTML Tutorial
CSS Tutorial
TCP/IP Tutorial
CSS 1.0
CSS 2.0
HLML
XML Tutorials
XML Tutorial
XSL Tutorial
XSLT Tutorial
DTD Tutorial
Schema Tutorial
XForms Tutorial
XSL-FO Tutorial
XML DOM Tutorial
XLink Tutorial
XQuery Tutorial
XPath Tutorial
XPointer Tutorial
RDF Tutorial
SOAP Tutorial
WSDL Tutorial
RSS Tutorial
WAP Tutorial
Web Services Tutorial
Browser Scripting
JavaScript Tutorial
VBScript Tutorial
DHTML Tutorial
HTML DOM Tutorial
WMLScript Tutorial
E4X Tutorial
Server Scripting
ASP Tutorial
PERL Tutorial
SQL Tutorial
ADO Tutorial
CVS
Python
Apple Script
PL/SQL Tutorial
SQL Server
PHP
.NET (dotnet)
Microsoft.Net
ASP.Net
.Net Mobile
C# : C Sharp
ADO.NET
VB.NET
VC++
Multimedia
SVG Tutorial
Flash Tutorial
Media Tutorial
SMIL Tutorial
Photoshop Tutorial
Gimp Tutorial
Matlab
Gnuplot Programming
GIF Animation Tutorial
Scientific Visualization Tutorial
Graphics
Web Building
Web Browsers
Web Hosting
W3C Tutorial
Web Building
Web Quality
Web Semantic
Web Careers
Weblogic Tutorial
SEO
Web Site Hosting
Domain Name
Java Tutorials
Java Tutorial
JSP Tutorial
Servlets Tutorial
Struts Tutorial
EJB Tutorial
JMS Tutorial
JMX Tutorial
Eclipse
J2ME
JBOSS
Programming Langauges
C Tutorial
C++ Tutorial
Visual Basic Tutorial
Data Structures Using C
Cobol
Assembly Language
Mainframe
Forth Programming
Lisp Programming
Pascal
Delphi
Fortran
OOPs
Data Warehousing
CGI Programming
Emacs Tutorial
Gnome
ILU
Soft Skills
Communication Skills
Time Management
Project Management
Team Work
Leadership Skills
Corporate Communication
Negotiation Skills
Database Tutorials
Oracle
MySQL
Operating System
BSD
Symbian
Unix
Internet
IP-Masquerading
IPC
MIDI
Software Testing
Testing
Firewalls
SAP Module
ERP
ABAP
Business Warehousing
SAP Basis
Material Management
Sales & Distribution
Human Resource
Netweaver
Customer Relationship Management
Production and Planning
Networking Programming
Corba Tutorial
Networking Tutorial
Microsoft Office
Microsoft Word
Microsoft Outlook
Microsoft PowerPoint
Microsoft Publisher
Microsoft Excel
Microsoft Front Page
Microsoft InfoPath
Microsoft Access
Accounting
Financial Accounting
Managerial Accounting


JavaScript If...Else Statement

Previous Next



If...Else statement
Bedingte Aussagen im Javascript werden verwendet, um die unterschiedlichen Tätigkeiten durchzuführen, die auf unterschiedlichen Bedingungen basieren.

Erklärung

Bedingte Aussagen werden verwendet, wenn du etwas wünschst zu geschehen, wenn eine Bedingung entweder zutreffend oder falsch ist. Du kannst jeder Gebrauch wenn oder schältst bedingte Aussagen. Bedingte Aussagen sind der empfindliche Fall und müssen in Kleinschreibung geschrieben werden.

If statementn verwendet werden, wenn du eine Bedingung überprüfen möchtest

sonst, wenn nach If statement hinzugefügt und dir erlaubt wird, auf einen anderen Zustand zu prüfen.

sonst wird nach wenn und sonst If statement hinzugefügt und dir erlaubt, etwas zu tun, wenn alle vorhergehenden Bedingungen ausfallen.




if statement
Du solltest verwenden If statement, wenn du irgendeinen Code durchführen möchtest, nur wenn ein spezifizierter Zustand zutreffend ist.

if (condition)
{
code to execute if condition true
}

Example:1

<script type="text/javascript"<

var name = "Vyom";

if (name = "Vyom")
{
document.write("Hello Rajesh");
}
</script<

Example:2

<script type="text/javascript">
//Write a "Good morning" greeting if
//the time is less than 10

var d=new Date()
var time=d.getHours()

if (time<10)
{
document.write("Good morning")
}
</script>

Example:3

<script type="text/javascript">
//Write "Lunch-time!" if the time is 11

var d=new Date()
var time=d.getHours()

if (time==11)
{
document.write("Lunch-time!")
}
</script>


Du benutzt immer zwei Gleichheitszeichen (==) nahe bei einander (==)! Wenn wir Variable vergleichend.

Beachten, daß es Nr. gibt. .else. in dieser Syntax. Du erklärst gerade den Code, irgendeinen Code durchzuführen, nur wenn der spezifizierte Zustand zutreffend ist.


If...else Statement

Wenn sonst, hat Aussage das gleiche Format ab „wenn“ Aussage. Nur zusätzliche Sache ist, daß ein sonst Teil If statement hinzugefügt wird. So, wenn die Bedingungen das Aussagen Innere erfüllt, wenn der Teil sonst durchgeführt wird, wird die Aussage innerhalb des sonst Teils durchgeführt.


Syntax of if..else statement

if (condition)
{
code to execute if condition true
}


Example:4

<script language="javascript">
var a = "1234abc";
if(a == "adcdefa")
{
document.write(" inside if statement ");
}
else
{
document.write(" inside else part of statement ");
}
</script>


output
inneres sonst Teil der Aussage
Im oben genannten Beispiel ist die Bedingung, zu überprüfen, ob Variable „a“ (==) „abcdefa“ entspricht. Die Bedingung fällt aus, da wir a als „1234abc“ zugewiesen haben. So wird das sonst Teil durchgeführt.


Example:5

<script language="javascript">
//If the time is less than 10,
//you will get a "Good morning" greeting.
//Otherwise you will get a "Good day" greeting.

var d = new Date()
var time = d.getHours()

if (time < 10)
{
document.write("Good morning!")
}
else
{
document.write("Good day!")
}
</script>


If...else if...else Statement
You should use the if....else if...else statement if you want to select one of many sets of lines to execute.

Syntax

if (condition)
{
code to execute if condition true
}
else if (condition)
{
code to execute if 2nd condition true
}
else
{
code to execute if above are false
}


Example:6

<script language="javascript">
var name = "Mary";

if (name = "John"){
document.write("Hello John ");
}
else if (name = "Peter")
{
document.write("Hello Peter");
}
else {
document.write("Hello Stranger");
}
</script>


Say Hello John to John, Hello Peter to Peter and Hello Stranger to anyone else.

Example:7

<script language="javascript">
var d = new Date()
var time = d.getHours()
if (time<10)
{
document.write("Good morning")
}
else if (time>10 && time<16)
{
document.write("Good day")
}
else
{
document.write("Hello World!")
}
</script>




Previous Next

Keywords: javascript tutorials, javascript code, javascript if else operators, javascript if else script type


HTML Quizes
HTML Quiz
XHTML Quiz
CSS Quiz
TCP/IP Quiz
CSS 1.0 Quiz
CSS 2.0 Quiz
HLML Quiz
XML Quizes
XML Quiz
XSL Quiz
XSLT Quiz
DTD Quiz
Schema Quiz
XForms Quiz
XSL-FO Quiz
XML DOM Quiz
XLink Quiz
XQuery Quiz
XPath Quiz
XPointer Quiz
RDF Quiz
SOAP Quiz
WSDL Quiz
RSS Quiz
WAP Quiz
Web Services Quiz
Browser Scripting Quizes
JavaScript Quiz
VBScript Quiz
DHTML Quiz
HTML DOM Quiz
WMLScript Quiz
E4X Quiz
Server Scripting Quizes
ASP Quiz
PERL Quiz
SQL Quiz
ADO Quiz
CVS Quiz
Python Quiz
Apple Script Quiz
PL/SQL Quiz
SQL Server Quiz
PHP Quiz
.NET (dotnet) Quizes
Microsoft.Net Quiz
ASP.Net Quiz
.Net Mobile Quiz
C# : C Sharp Quiz
ADO.NET Quiz
VB.NET Quiz
VC++ Quiz
Multimedia Quizes
SVG Quiz
Flash Quiz
Media Quiz
SMIL Quiz
Photoshop Quiz
Gimp Quiz
Matlab Quiz
Gnuplot Programming Quiz
GIF Animation Quiz
Scientific Visualization Quiz
Graphics Quiz
Web Building  Quizes
Web Browsers Quiz
Web Hosting Quiz
W3C Quiz
Web Building Quiz
Web Quality Quiz
Web Semantic Quiz
Web Careers Quiz
Weblogic Quiz
SEO Quiz
Web Site Hosting Quiz
Domain Name Quiz
Java Quizes
Java Quiz
JSP Quiz
Servlets Quiz
Struts Quiz
EJB Quiz
JMS Quiz
JMX Quiz
Eclipse Quiz
J2ME Quiz
JBOSS Quiz
Programming Langauges Quizes
C Quiz
C++ Quiz
Visual Basic Quiz
Data Structures Using C Quiz
Cobol Quiz
Assembly Language Quiz
Mainframe Quiz
Forth Programming Quiz
Lisp Programming Quiz
Pascal Quiz
Delphi Quiz
Fortran Quiz
OOPs Quiz
Data Warehousing Quiz
CGI Programming Quiz
Emacs Quiz
Gnome Quiz
ILU Quiz
Soft Skills Quizes
Communication Skills Quiz
Time Management Quiz
Project Management Quiz
Team Work Quiz
Leadership Skills Quiz
Corporate Communication Quiz
Negotiation Skills Quiz
Database Quizes
Oracle Quiz
MySQL Quiz
Operating System Quizes
BSD Quiz
Symbian Quiz
Unix Quiz
Internet Quiz
IP-Masquerading Quiz
IPC Quiz
MIDI Quiz
Software Testing Quizes
Testing Quiz
Firewalls Quiz
SAP Module Quizes
ERP Quiz
ABAP Quiz
Business Warehousing Quiz
SAP Basis Quiz
Material Management Quiz
Sales & Distribution Quiz
Human Resource Quiz
Netweaver Quiz
Customer Relationship Management Quiz
Production and Planning Quiz
Networking Programming Quizes
Corba Quiz
Networking Quiz
Microsoft Office Quizes
Microsoft Word Quiz
Microsoft Outlook Quiz
Microsoft PowerPoint Quiz
Microsoft Publisher Quiz
Microsoft Excel Quiz
Microsoft Front Page Quiz
Microsoft InfoPath Quiz
Microsoft Access Quiz
Accounting Quizes
Financial Accounting Quiz
Managerial Accounting Quiz

Privacy Policy
Copyright © 2003-2024 Vyom Technosoft Pvt. Ltd., All Rights Reserved.