Web page effects browser type and version information detection code
function Check (reg) {var ug = navigator.userAgent.toLowerCase ();Return Reg.test (UG);}function Checkbrowser () {var ug = navigator.userAgent.toLowerCase ();var useragent =
Arr[j]==i you seem to refer to the equality judgment when an array element is a number type ...But often we may have to make equality judgments about different types of ... This is the practical application of the problem should be considered
Case
Web page effects cookie Read and set operation instance
/* Read and write cookie*/
function Readcookie (name)
{
var cookievalue = "";
var search = name + "=";
if (Document.cookie.length > 0)
{
offset = document.cookie.indexof
typeof can get the type of a variableThere are 6 types of return values:
1) number;2) string;3) Boolean;4) Object5) function;6) undefined.
Check variable type method one: typeofFormat: typeof variableUsage: if (typeof variable = =
Web page Special Effects page simplified and traditional conversion algorithmvar defaultencoding = 2; 1:var translatedelay = 0;var cookiedomain = "Http://www.111cn.net"; Change to your blog URLvar Msgtotraditionalchinese = "traditional"; Here you
(1) Changes the structure of the page when the page is loaded. A "Terminate operation" error occurs in IE6 if the network slows down or the page content is too large. This means "never change the DOM model of a page when the page is loaded."
(2)
Frame.html, top.html, bottom.html as an example to specify how to do.Frame.html consists of two pages (bottom.html) on top (top.html) with the following code:
Now assume that top.html (that is, the page above) has seven button to achieve the bottom.
Ever want to find one of your JavaScript strings? Even start searching for half the string? Then you're in your good luck! The string function IndexOf allows you to provide an argument (search query), as well as an optional parameter (offset) to all
This may be an old message to you, but in every JavaScript string there are several features that are just waiting to do your bidding. This is because the JavaScript string is actually a group of objects of nature and functions (also known as
String str= "123abc456";int i=3;1 Take the first I character of a stringStr=str.substring (0,i); or Str=str.remove (i,str.length-i);
The substring returned by the substring () method includes the character at start, but does not include the
JavaScript String Object
Let's take a look at an instance of the length of the returned character.
Result is 12
Let's look at an example.
The IndexOf () methodHow to use the IndexOf () method to return the position of the first occurrence
Web Effects Array Operation example
var arr = new Array (1,2,3,4);If the incoming argument is 2The result returned is 35 (1*2+1*3+1*4+2*3+2*4+3*4=35)If the incoming argument is 3The result returned is 50 (1*2*3+1*2*4+1*3*4+2*3*4=50)
His radio is this:
Select all:
Select all background color
function CA () {
var value = form1.del_all.checked? ' H ': ';
if (form1.del_id.length) {
for (Var i=0;iform1.del_id[i].checked=form1.del_all.checked;
Web Effects date number Regular expression
The number is regular/^d{3,4}-d{7,8} (-d{3,4})? $/The area code must be filled with a 3-4-digit number, followed by "-" and the telephone number
^d{3,4}-Number with 7-8 digits
d{7,8}The number of the
Web Effects for...in StatementFor...in declarations are used to iterate over the properties of an array or object.
The code in the for ... in loop performs an operation on the elements of the array or the properties of the object every time it
The condition of a leap year is one of the following two conditions:1, can be divisible by 4, but not divisible by 100;2, divisible by 4, and divisible by 400. Because it can be divisible by 400, it must be divisible by 4, soThe second condition can
Web page effect string not finished resolution
My solution has two, one is to replace the string variable operation, the double quotes into single quotes
, the single quotation mark is replaced with "", but it is replaced with the original text
Web effects to create their own classes and objects, we should be mastered, we all know that the properties of the object in JavaScript can be dynamically defined after the object is created, such as the following code:The code is as follows:
1. In general, if you want to Add some javascript features to web form control on the aspx page, you can use Attributes. Add.For example, for TextBox txt, you can:Txt. Attributes. Add ("onclick", "fcn0 ();");Then, when you click it on the web page,
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