Home > Web Front-end > JS Tutorial > Automatically call different CSS codes according to the browser type and screen resolution_javascript skills

Automatically call different CSS codes according to the browser type and screen resolution_javascript skills

WBOY
Release: 2016-05-16 19:18:59
Original
1135 people have browsed it

Determine both the resolution and the browser

Re-improve the code to make it a code that automatically calls different CSS to determine the browser type and screen resolution.

Copy code The code is as follows:

Explanation:

var IE1024="";
var IE800="";
var IE1152="";
var IEother ="";

Fill in the quotation marks respectively, and the css file name to be used when the user uses IE and the resolution is 1024*768, 800*600, 1152*864.


var Firefox1024="";
var Firefox800="";
var Firefox1152="";
var Firefoxother="";

Fill in the quotation marks separately, and distinguish them when the user uses FF The css file name to be used is 1024*768, 800*600, 1152*864.

var Other1024="";
var Other800="";
var Other1152="";
var Otherother="";

Fill in the quotation marks respectively, and the css file name to be used when the user uses other browsers and the resolution is 1024*768, 800*600, 1152*864.

Does not judge resolution, only judges browser

Achieve automatic calling of different CSS according to browser type.

Copy code The code is as follows:


Explanation:
If the browser is IE, call default.css
If the browser is Firefox, call default2.css
If the browser is other, call newsky.css

Usage: Place
in front of
[codes=xml]
[/codes]
.

Only determines the resolution, not the browser

Copy the code The code is as follows:

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template