时间:2021-07-01 10:21:17 帮助过:27人阅读
css ajax
Product Name |
---|
AirPlane |
Big car |
现在页面的文字样式,背景,字体大小,都是系统默认的,待会儿,给大家演示下运行结果,可以比较下哦
test.js
function setStyle1(){ //将表的风格改为style1 //获取html的引用 oTable = document.getElementById("table"); oTableHead = document.getElementById("tableHead"); oTableFirstLine =document.getElementById("tableFirstLine"); otableSecondLine = document.getElementById("tableSecondLine"); //设置风格 oTable.className ="Table1"; oTableHead.className ="TableHead1"; oTableFirstLine.className ="TableContent1"; oTableSecondLine.classNamee ="TableContent1";}function setStyle2(){ //将表格的风格改为style2 //获取html元素的引用 oTable = document.getElementById("table"); oTableHead = document.getElementById("tableHead"); oTableFirstLine =document.getElementById("tableFirstLine"); otableSecondLine = document.getElementById("tableSecondLine"); //设置风格 oTable.className ="Table2"; oTableHead.className ="TableHead2"; oTableFirstLine.className ="TableContent2"; oTableSecondLine.classNamee ="TableContent2";}
styles.css
/* @CHARSET "GB18030"; */.Table1{ border:DarkGreen 1px solid; background-color:LightGreen; }.TableHead1{ font-family:Verdana,Arial; font-weight:bold; font-size:10pt; }.TableContent1{ font-family:Verdana,Arial; font-size:10pt; }.Table2{ border:DarkBlue 1px solid; background-color:LightBlue; }.TableHead2{ font-family:Verdana,Arial; font-weight:bold; font-size:10pt; }.TableContent2{ font-family:Verdana,Arial; font-size:10pt; }
运行效果如下:
另外这些知识点可以用在UIWebView与js的交互上哦,下面给大家演示下运行及效果哦
iOS的demo地址:demo