zoukankan      html  css  js  c++  java
  • 今天写了个动态切换样式文件,感觉比我之前做的那个好多了哦。

    /Files/Silvia/css_change.rar

    页面代码:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link rel="stylesheet" href="red.css" id="lf"/></link>
    </head>
    <script>
    function abc(obj)
    {
        
    var linkfile=document.getElementById('lf');
        
    var c=obj.selectedIndex;
        
    if(c==1) linkfile.href='red.css';
        
    else if(c==2) linkfile.href='green.css';
        
    else linkfile.href='yellow.css';
    }
    </script>
    <body>
    <div></div>
    <select id="selCss" onchange="abc(this)">
        <option value="0">请选择颜色</option>
        <option value="1">红色</option>
        <option value="2">绿色</option>
        <option value="3">黄色</option>
    </select>
    </body>
    </html>
  • 相关阅读:
    jdbc练习demo
    需登录账号与密码的网页爬取demo
    获取中文的首字母demo
    短信发送接口demo
    读取配置文件工具demo
    省选模拟96
    省选模拟95
    省选模拟94
    省选模拟92
    省选模拟91
  • 原文地址:https://www.cnblogs.com/Silvia/p/2546594.html
Copyright © 2011-2022 走看看