Today we are going to solve some of the problems in the last drag-and-drop prototype. What are the questions below?Attach the JavaScript code of the previous period to make it easier for you to see the problem.script type="Text/javascript">Window.onload = function() { varOdiv = document.getElementById ("Div1");varDISX =0;varDisy =0; Odiv.onmousedown = func
If you don't know why, don't worry too much, study CSS rules and view this article: use CSS to fix everything: 20 + common bugs and fixes.
If this is not the case, you can fix it with the 12 JavaScript solutions listed below, so that your Web page looks like it can cross all browsers!
In this article, we'll uncover JavaScript solutions to the 12 most common CSS problems
If you do not know the cause and do not worry too much, study the CSS rules and read this article: Use CSS to correct everything: 20 + Common Errors and fixes.If these are invalid, you can fix them using the 12 javascript solutions listed below, so that your web page looks like it can span all browsers!In this article, we will unveil the javascript solution for the 12 most common CSS
ArticleDirectory
1. Auto-Match Height
2. Transparent support for IE6 PNG
4. CSS browser Selector
5. minimum/maximum height/width support
6. Vertical/horizontal center of Elements
7. Use the Q tag in IE
We advocate using CSS as much as possible, and we often do this. Modern browsers have good CSS support-this is definitely good enough for you to use CSS to control layout and layout design. However, some web page elements may be different in different browsers.
If
This article briefly introduces 12 Javascript methods to solve common browser compatibility problems. modern browsers have good CSS support-which is definitely good enough for you to use CSS to control layout and layout design. However, some web page elements may be different in different browsers.
12 Javascript methods to solve common browser compatibility
a variable is optimistic, the amount of recycling is quite large. If you need to clean up a lot of space. In this case, determining the event interval of garbage collection is a very important problem, the garbage collection mechanism of language coding is more convenient, but the internal mechanism is relatively complex, to ensure that less memory can make the page better performance. The best way to optimize memory consumption is to save only the necessary data for the code in execution. Once
A quick solution to 23 problems of Multi-browser compatibility in JavaScript, javascript23
I. document. formName. item ("itemName ")
Problem description: in IE, you can use document. formName. item ("itemName") or document. formName. elements ["elementName"]; In Firefox, only document. formName. elements ["elementName"].
Solution: Use document. formName. elements ["elementName"].
Ii. Collection objects
Prob
highest element. EqualHeights () cyclically tests the child nodes at the highest level of a specified element, and then sets their minimum height to the height of the highest element.
Click here to preview the effect
◆ Match the column height with jQuery
Another plug-in of jQuery that can make the height of the box equal:
$(“#col1,#col2″).equalizeCols();
Match the height as you think:
$(“#col1,#col2″).equalizeCols(“p,p”);
Match the two volumes and add a blank space after the
Here I briefly talk about the coding problems that are often encountered in front-end HTML and JavaScript daily work.
In a computer, the information we store is expressed in binary code. We know, the on-screen display of English, Chinese characters and other symbols and stored binary code of the conversion, that is, coding.
There are two basic concepts to note, CharSet and character encoding:
CharSet, cha
Nbsp; In javascript events, when the parameter is an encoded value, javascript will decode it and execute the following code. Lt; ahref # onmousemove amp; #97; amp; #108; amp; #101; amp; #114; amp; #116; amp; #40; amp; #47; amp; #119; amp;
In javascript events, when the parameter is an encoded value, javascript
conflict, which is number type and object type (its subclass number type), therefore, instanceof to exclude the types specified in the data types that are already defined, that is, only for custom types.In addition, for arrays with only the concept of class array, there is no array data type, typeof can only return the object data type, so for arrays it is possible to use instanceof.In summary: There is no need to tangle with JavaScript syntax, becau
group object6 7 if(Myarrays = =NULL) {//detect if the cookie has no value8 //set to a spatial array by default9Myarrays =NewArray ();Ten$.cookie ('The_cookieselectfoodorderck','[]', {path:"/", Expires:-1});//Delete Cookies One}Else { A for(vari =0; i ) { - //according to the order type and date - if(myarrays[i].foodate.tostring () = = Foodate.tostring () myarrays[i].foodtype.tostring () = =foodetype.tostring ()) { the -M
This problem may be overlooked, and I have encountered it in the project. Wrote a reminder to everyone!!!When using JavaScript's parseint function, the parseint ("08") or parseint ("09") returned is actually 0, while parseint ("07") is correct, it is difficult to understand at first, It was later discovered that the problem was that when "0" was in front of it, JavaScript's debugger would think of it as an octal number, while "08" and "09" were not a valid octal number, which caused the problem,
In javascript events, when the parameter is an encoded value, javascript will perform the decoding in the following code.
In addition, because javascript supports function parameters, the following code can be used:
Two features can cause the following security problems:
When
Firefox, even objects have the target attribute, but there is no srcelement attribute.
Workaround: Use Srcobj = event.srcelement? Event.srcElement:event.target;
If the 8th question is considered, replace the event with MyEvent instead.
Xi. the question of window.location.href
Problem Description: Under IE or firefox2.0.x, you can use Window.location or window.location.href;firefox1.5.x, only use window.location.
WORKAROUND: Use window.location instead of window.location.href. Of course, yo
through the database property.Two. About literal assignment, array assignment?
1234567
vara=1,b=2;var c=[a,b];console.log(c);//[1,2]var b=3;console.log(c);//[1,2]varc=[a,b];console.log(c);//[1,3]
The value assigned to a, a, B is a number, C is an array of a and a, because the value of a B is 1 and 2, so var c=[a,b] is equal to Var c=[1,2], after which the value of a and B is changed to c=[1,2] irrelevant.The above is a summary of the problem of the dataset in
Here I will briefly discuss the coding problems that often occur in the daily work of front-end HTML and JavaScript.
In the computer, the information we store is represented by binary code. What we know, the English and Chinese characters displayed on the screen, and the binary used for storage
Code Is the encoding.
There are two basic concepts to describe: charset and character encoding:
Charset, ch
Simple javascript performance problems and Study Notes
I recently read a book titled "high-performance javaScript" and found that many minor details exist in my javaScript writing. Although these problems do not cause program running errors, they may slow the interface load
This article by Bole Online-elviskang translation, into the forest School draft. without permission, no reprint!English Source: adripofjavascript.com. Welcome to join the translation team.The for...in loop of JavaScript is used to iterate over an enumerable (enumerable) property in an object:
1234567891011121314151617
var tMinus = {two: "Two",one: "One",zero: "Blast off!"};var countdown = "";for (var step in tMinus) {countdown += tMin
) {
//Get the number of FN parameters
var n = fn.length;
Declares an array args
var args = [];
Returns an anonymous function return
function (ARG) {
//Curryit The arguments in the back brackets to the array
Args.push (ARG);
If the number of parameters in the args is less than the number of parameters of the FN function,
//executes Arguments.callee (which refers to the currently executing function, which is the current anonymous function returned).
//Oth
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.