search
Homephp教程PHP开发js implements switching between two sets of css on a single html page

Step one: Import two sets of css files

[html]

[html]

links = document.getElementsByTagName("link");

//Determine whether each link element contains a style string, used to determine this link element is the style sheet link, and determines whether the link contains the title attribute

for(i=0; links[i]; i++){

if(links[i].getAttribute("rel").indexOf("style") ! = -1 && links[i].getAttribute("title")){

//Set all links to disabled

links[i].disabled = true;
//Then determine whether there is a specified title string in the title Some set the current link as visible to activate the current link
if(links[i].getAttribute("title").indexOf(title) != -1){
links[i].disabled = false;
//alert("ok");
}

}
}
}

Step 3: Call the switched js function in the html tag

[html]


< ;a href="http://www.php1.cn/">



Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version