js获取外联样式

 时间:2024-10-14 11:27:33

1、<!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><script type="text/javascript"> function changeBackgroundColor() { //这儿如何写访问外部样式表中代码(比如:.special中的border值) }</script><link href="default.css" rel="stylesheet" type="text/css" /></head><body><div id="div1" class="special"></div><input type="button" value="Change Background Color" onclick="changeBackgroundColor()" /></body></html>

2、使用window.getComputedStyle('')

3、window也可以去掉

  • CSS中有哪些常用选择器?
  • java编程:判断某年是否为闰年
  • CSS3教程 为元素添加圆角边框
  • css滤镜实现鼠标悬停图片变黑白(灰色)
  • navicat的应用方法
  • 热门搜索
    缅怀先烈手抄报图片 预防禽流感手抄报 母亲节手抄报的内容 感恩母爱手抄报第一名 欢庆六一节手抄报 我的寒假生活手抄报 青少年心理健康手抄报 读书手抄报内容大全 国防教育手抄报内容 扫黑除恶手抄报大全