Although JS can want to object-oriented way to construct objects, hidden private methods, but the need for change is often faster than you write the program, even the design of JS object time is not, so I prefer to use JS private functions and JS
Copyright Notice: Original works, allow reprint, reprint, please be sure to hyperlink form to indicate the original publication of the article, the author's information and this statement. Otherwise, legal liability will be
As shown below:
function GetStyle (node, property) {
if (Node.style[property]) {return
node.style[property];
else if (node.currentstyle) {return
node.currentstyle[property];
else if (Document.defaultview &&
STR is the xmlrequest that is returned via Ajax
/* Dynamically load CSS style*/
function Loadstyle (str)
{
var regexp_src=/[^<>]*/gi;
var matcharray_src=str.match (REGEXP_SRC);
Alert (matcharray_src[0]);
if (MATCHARRAY_SRC) {
for (Var i=0;i{Alert
If you have a lot of related CSS files to load together, or want to dynamically load different CSS files, then the following methods you must be helpful.jquery dynamic loading js and CSS extension methods
$.extend ({
includepath: ",
Use JS and CSS to tell the reality of the picture control in a fixed area, greater than the proportion of this area scaling, less than the center of the region display.
css+js perfect control picture size
[Ctrl + A All
[Add CSS styles dynamically]
Test
[Dynamic Add script label]
Principle Ditto
Test
The above is a small series to introduce the JavaScript dynamic add CSS style and script tags, I hope to help
JQuery Operations CSS
AddClass ()-add one or more classes to the selected element
Removeclass ()-deletes one or more classes from the selected element
Toggleclass ()-Toggle operation of the Add/Remove class to the selected element
CSS
Query is a JavaScript CSS selector engine, compact and powerful, compressed around 2k, can be easily integrated into the code.Support Browser
ie6+, Firefox, Chrome, Safari, Opera
SelectorQuery (Selector[,context])Div#introDiv#intro.
Using jquery to get the value of the Background-color in a style, it is found that the color value obtained in the IE10 is displayed in hex format in the following version, while IE10, Chrome, and Firefox display RGB in GRB format ( 255,0,0) ",
1. Transparency:If you don't specify a background color or a background image for a text, the background of the element is usually transparent.This is important, if an absolutely positioned and text element is placed on top of a text element, it
Pre-loading files generally have two common ways: xhr and dynamically inserting nodes. Dynamic Insert node is the simplest and most extensive asynchronous loading method (such as Yui's Get module), and then use the dynamic Insertion node method
Let's take a look at how to get the position of the cursor relative to the entire page, because the cursor position variable x,y is typically obtained by mouse events (such as MouseMove or MouseDown), and the following two common functions are used
For example: elem.style.height or elem.style.height = ' 100px ', it is important to note that any geometry attribute must be set to the specified size unit (such as PX), and that any geometry property returns a string representing the style rather
1. When changing a single element style, note that the syntax of the style object is almost one by one corresponding to the syntax used in CSS. However, attributes that contain hyphens are replaced with the form of a "camel castring", for example:
The CSS () method sets or returns one or more style properties of the selected element.
Set CSS Properties
To set the CSS properties you specify, use the following syntax:
Copy Code code as follows:
CSS ("propertyname", "value");
We are browsing some websites, especially some novel websites, there will be a change in the background color of the page, this feature using jquery is easy to implement.
Effect Chart:
Show your code:
Copy Code code as follows:
Recently in the framework of writing projects, write a Jquerymessagebox class, to use the JQuery UI dialog () to display the message box, in order to make the method easy to invoke, it is added to automatically determine whether the page is joined
Art to do the CSS style icon more and more, hand to write icon name is almost impossible to achieve. So there is this function point: the CSS style of all the icon class enumerated in a graphical format for the configuration of the selection of
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