";break;case5:x="Todayit'sFriday";break;case6:x="Todayit'sSaturday";break;}
X running result:
Todayit'sSaturday
Default keyword
Use the default keyword to specify what to do when the match does not exist:
Instance
If today is not Saturday or Sunday, the default message will be output:
varday=newDate().getDay();switch(day){case6:x="Todayit'sSaturday";break;case0:x="Todayit'sSunday";break;default:x="LookingforwardtotheWeekend";}
Running result of x
Todayit'sSaturday
The above is the content of the
JavaScript: Pay attention to the test method of the RegExp object in JavaScript. Javascript tutorial
The RegExp object in javascript is used for operations related to regular expressions. This object provides a method test to determine whether a string meets a certain patter
Timing of JavaScript advanced tutorial (lesson 3) events and browser recognition
With the increasingly rich JavaScript, we can develop more and more complex applications. In the last course, we learned how to use JavaScripts to write Cookies. Today we will learn how to add the timing function. The time-based timing function is very useful in browsers, and can
HTML Dom tutorial 49-javascript number object
In JavaScript, numbers are a basic data type.
Javascript supports the number object, which is the packaging object of the original value.
When necessary, JavaScript will automatically convert between the original data an
" (x==y) in the strict comparison operation,=== is the identity of the operator, while checking the expression value and type, the following if conditional statements return false:var x=10;vary=;if (x===y) This error often appears in the switch statement, The switch statement is compared using the identity calculation character (= = =): The following instance executes alert popup: Varx=10;switch (x) { case10:alert ("Hello");} The following instances do not execute because of type inconsistency a
viewing CPU execution time and memory consumption:This is not familiar, do not say more, or please refer to the end of the link.Audits label pageThis is useful for optimizing front-end pages and speeding up page loading (quite with YSlow):Click the Run button, you can start analyzing the page, you can see the analysis results are finished:It can even analyze what CSS is not being used in the style sheet on the page:Console tab pageIs the JavaScript c
PhantomJS quick start tutorial (WebKit for JavaScript APIs on the server side) and phantomjswebkit
PhantomJS is a WebKit-based server-side JavaScript API. It fully supports the web without the support of the browser. It is fast and native supports various Web standards: DOM processing, CSS selector, JSON, Canvas, and SVG. PhantomJS can be used for page automation
How to dynamically load events in the Javascript tutorial
This article mainly gives a detailed summary of several methods for loading events in js. If you need it, please refer to it and hope to help you.
Some methods to dynamically load javascript events sometimes
We often need to dynamically add events in JS, which involves browser compatibility issues. The fo
primarily performance-optimized, including viewing CPU execution time and memory consumption:This is not familiar, do not say more, or please refer to the end of the link.Audits label pageThis is useful for optimizing front-end pages and speeding up page loading (quite with YSlow):Click the Run button, you can start analyzing the page, you can see the analysis results are finished:It can even analyze what CSS is not being used in the style sheet on the page:Console tab pageIs the
This article mainly introduces the use of JavaScript to achieve page redirection function of the tutorial, is the basic knowledge of JS learning, the need for friends can refer to the
What is page redirection?
When you click on a URL to access a page x, but inside you are directed to another page y, just because of page redirection. The idea is to refresh from a different
Cgi|javascript|js| Tutorial uses JavaScript instead of CGI
You might be familiar with CGI scripts, and you can use CGI to pass numbers or variables from one page to another on a form. Of course, you can use "POST" to pass a variable to a separate thread without appearing in the browser, or to encode the variable to a URL using "get".
JavaScript For statement Use instance Tutorial
The number of times specified to execute the same code block in JavaScript or the specified condition is true.
ExampleFor loopHow to write a link. The number of times that the same code block is run by the closed loop used.
HTML title by loopingHow to use the loop loop through different HTML headings.
AJAX: implement mutual exclusion secrets in AJAX programs. The Javascript tutorial is more and more widely used with AJAX examples, browser pages can maintain the activity of the front-end user interface while requesting data from the backend server (thus called asynchronous in AJAX ). However, when the two activities access the shared JavaScript and DOM data str
JavaScript: String operations in JavaScript, Javascript tutorial
I. OverviewStrings are almost everywhere in javascript. When you process user input data and read or set DOM object attributes, there are more strings when operating cookies .... The core part of
, logical operators, bitwise operators, ternary operators.The operators in JavaScript are roughly the same as Java. Just a few points to note during the operation:
var x = 3120/1000*1000; x = 3120 instead of 3000
var x = 2.4 + 3.6; x = 6 instead of 6.0
var x = "12" + 1; x = "121" Because the plus sign is a connector for a string
| | is the logical operator, | is a bitwise operator
Ternary operators are al
This article mainly introduces detailed information about the {} statement block in javascript. For more information about how to parse the json string, see the next tutorial. an eval () method is used, why should we add parentheses when parsing strings? Confused. In the original javascript, the {} statement block has two meanings, and errors may occur without pa
Javascript Tutorial: querySelector () method,
Module dom {[Supplemental, NoInterfaceObject]Interface NodeSelector {Element querySelector (in DOMString selectors );NodeList querySelectorAll (in DOMString selectors );};Document implements NodeSelector;DocumentFragment implements NodeSelector;Element implements NodeSelector;};
From the interface definition, we can see that Document, DocumentFragment, and Eleme
I am reading the JavaScript tutorial, the teacher said in the future with "Ah Dot" (pronunciation), what is this? What am I going to search for?
This issue has been closed because of a discussion-based question of non-technical questions
Reply content:
I am reading the JavaScript tutorial, the teacher said in th
Javascript| tutorial using JavaScript in HoTMetaL
3. What resources are appropriate for scripting
When you use HoTMetaL PRO 6.0 to write macros, you can use the following resources:
Predefined events
HoTMetaL PRO 6.0 defines several events and special user-defined macros to handle them. These macros should be named after the HoTMetaL instructions. For exa
This article is the official HTML5 training course for h5edu institutions, mainly introduces: JavaScript intensive tutorial--jquery-chainingWith JQuery, you can link actions/methods together.Chaining allows us to allow multiple jQuery methods (on the same element) in one statement.JQuery Method LinksUntil now, we have written a jQuery statement one at a time (followed by another).However, there is a techniq
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.