//function Sizeinit () {var Fsize=getcookie ("Fsize");if (fsize>15) {ChangeColor (0);}else{ChangeColor (1);}var objs=document.getelementsbyname ("Content_show");for (i=0;iobjs[i].style.fontsize=fsize+ ' px ';}}Set the size of the article font by the value of the cookie Fsizefunction SetFont (o,f) {Setcookie ("Fsize", f); Set cookiesSizeinit ();}Discolorationfunction ChangeColor (c) {var objs=document.getelementsbyname ("Middle_size");var objs1=document.getelementsbyname ("Big_size"); Get an arra
Js operation cookies include: Writing cookies, reading cookies, deleting cookies, and using examples. If you are interested, refer
The Code is as follows:
// JS cookies operation method!// Write cookiesFunction setCookie (name, value){Var Days = 30;Var exp = new Date ();Exp. setTime (exp. getTime () + Days x 24x60*60*1000 );Document. cookie = name + "=" + esca
This is my first diary in the garden.
I am a. netProgramClerk, has been very stubborn on the C # syntax structure. In the past, when developing ASP. NET programs, many JavascriptCode. But basically, I don't like JavaScript's erratic syntax structure.
Why cannot the syntax structure of JavaScript be as elegant as that of C?
I want to write JavaScript code like C. This is the "rocksniper. scripts. js" libr
We usually use Eclipse to develop JSP page Smart hints effect is not ideal, today took two hours to discover eclipse can also be like Visual Studio 2008, the full intelligent hint Html/js/css code, using the eclipse comes with the plug-in, There is no need to install additional plugins, the following steps1. Open Eclipse→windows→preferences→java→editor→content AssistTo modify the value of auto Activation triggers for Java: Zjava Click the Apply button
perfectly back, and the requested page is present . OneConsole.log (Xml.responsetext);//enter the appropriate content A } -} POST request1 //Creating an Asynchronous object2 varXHR =NewXMLHttpRequest ();3 //set the type and URL of the request4 //The POST request must be added to the request header, or it will be an error.5Xhr.setrequestheader ("Content-type", "application/x-www-form-urlencoded");6Xhr.open (' Post ', ' 02.post.php ' );7 //Send Request8Xhr.send (' name=foxage=18 ');9Xhr.onre
We usually use Eclipse to develop JSP page Smart hints effect is not ideal, today took two hours to discover eclipse can also be like Visual Studio 2008, the full intelligent hint Html/js/css code, using the eclipse comes with the plug-in, There is no need to install additional plugins, the following steps1. Open Eclipse→windows→preferences→java→editor→content AssistTo modify the value of auto Activation triggers for Java: Zjava Click the Apply button
The picture query out, but also need to add a view of the large image function, and then use JS to write a method, and then in the image of the onmouseover event call this method, so that in the mouse hovering over the small picture, its large picture will automatically display.
JS code showing large and hidden large images:
Copy Code code as follows:
First, the basic ideain order for us to write a Web page progress bar to meet the existing requirements, but also light enough, so use native js to write a constructor, in order to see the name of the meaning, the function can be named "Loading". The function receives 2 parameters, arr, callback, respectively. Where arr defines the image array, callback defines t
For example:
VaR A = [1, 5, 3, 7];
A. Sort (function (a, B) {return B-A}); // arranged from big to small
Then how should we write this comparison function for the order of complex points.
For the comparison function f (a, B) {...}, if a positive number is returned, it means that a and B need to be exchanged; otherwise, it is not exchanged. Therefore, we can write the comparison function in the following for
Problem: There are a lot of picture files in folder a, you need to replace the A picture with another picture, but the name remains the Same.The manual procedure is as Follows:1) Browser Open picture->2) save As->3) target Folder->4) Find a picture->5) replace->6) OKthen, Repeat step 2) and follow the Steps. Accidentally missing or Repeated.So much trouble, how about using Node. JS to handle the change? The code is as Follows:1 varFs=require (' FS '),
node. js in FS moduleCommon featuresImplementing read- Write directory operations for files-Synchronous and asynchronous coexistence, asynchronous without synchronization-Fs.readfile cannot read a file that is larger than the running memory and will not use the ReadFile method if the file is too large-File large shunt read, stream- introduction of FS module-Let Fs=require (' FS ')Read files synchronously-fs
;};This. setAge = function (){Age =;};});
Write subclass, inherited from Person
The Code is as follows:
$ Class ("Man", Person, function (supr ){Var school;This. init = function (n, a, s ){Supr. init. apply (this, [n, a]);School = s;}This. getSchool = function (){Return school;};This. setSchool = function (s ){School = s;};});
A new subclass instance
The Code is as follows:
Var m = new Man ('Tom ', 25, 'pku ');
+ ''). replace (0,''). replace (/(. {5}),/g, '$1 \ r \ n ');
}
Document. writeln ('');
Var p = 8, d = gd (), t1 = document. getElementById ("t1 ");
SetTimeout ('T1. value = v () ', 10 );
Document. onkeyup = function (e ){
Var k = (e | window. event). keyCode-36, q;
If (k = 1 (p % 3
Q = p + (k> 2? 1:-1) * (k % 2*2-3 );
D [p] = d [q], d [p = q] = 0;
If (t1.value = v (). match (/^ 1, 2, 3 [^ \ d] * 4, 5, 6 [^ 0] * $ /))
Alert ('You WIN! ');
}
}
Script
Replay supplement: I re-wrote a version of a
We all know that JavaScript is used to manipulate css attributes. style is usually used directly for css attributes that are not underlined. the property name, for example, obj. style. margin, obj. style. width, obj. style. left, obj. style. position. For css attributes that contain dashes, remove each dashes and replace the first character after each dashes with uppercase letters. For example, obj. style. marginTop, obj. style. borderLeftWidth, obj. style. zIndex, obj. style. fontFamily, etc. H
Recently in Learning JS knowledge, for me this rookie, JS let me too painful. Once did not know who said JS is very simple, so learn, learned to know ... It's all holes ....Now to share a simple shopping cart that I have endured with great pain is not perfect. Although I am not a complete, but I am trying to understand to get back to be ready to share out. Please
110 99 46 18 4 10 2 85 83 24 2]
Server received 28 bytes
The difference between the two is obvious, especially in areas where there is a need to save traffic, such as the mobile side, Protobuf's advantages are not to mention.
Three. Simple usage of PROTOBUF
Rely on the following JS
Long.min.js OptionalByteBufferAB.min.js
ProtoBuf.min.js
Then you need to define a proto file, take the official website as an example (Complex.proto).
Key
Use js to read, write, and delete Cookie codes.
In the last article, I used JavaScript to read, write, and delete Cookie code, share and describe in detail, and found some problems in practice:
1. Cookies can only be debugged on Firefox on local files, and IE and chrome are invalid.
2. The cookie is not set to never expire. It is obviously not reasonable to set a
Copy codeThe Code is as follows:$ (Function (){Var handler = function (){}Var timer = setInterval (handler, 1000 );Var clear = function (){ClearInterval (timer );}}); I want to add a page Jump in the timer and load the timer when loading the page. How to write it?The implementation is like how many messages are prompted at the place where Baidu initiates instant messages. The method for querying the number of items in java is available. How to
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.