cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <table>
	<caption>Itinerary</caption>
	<thead>
		<tr>
		  <th>When</th>
		  <th>Where</th>
		</tr>
	</thead>
	<tbody>
		<tr>
		  <td>June 9th</td>
		  <td>Portland, <abbr title="Oregon">OR</abbr></td>
		</tr>
		<tr>
		  <td>June 10th</td>
		  <td>Seattle, <abbr title="Washington">WA</abbr></td>
		</tr>
		<tr>
		  <td>June 12th</td>
		  <td>Sacramento, <abbr title="California">CA</abbr></td>
		</tr>
	</tbody>
</table>
            
          
!
            
              body {
  font-family: "Helvetica","Arial",sans-serif;
  background-color: #fff;
  color: #000;
}
table {
  margin: auto;
  border: 1px solid #699;
}
caption {
  margin: auto;
  padding: .2em;
  font-size: 1.2em;
  font-weight: bold;
}
th {
  font-weight: normal;
  font-style: italic;
  text-align: left;
  border: 1px dotted #699;
  background-color: #9cc;
  color: #000;
}
th,td {
  width: 10em;
  padding: .5em;
}
.odd {
  background-color: #ffc;
}
            
          
!
            
              function addLoadEvent(func){
	var oldonload = window.onload;
	if(typeof window.onload !="function"){
		window.onload = func;
	}else{
		window.onload = function(){
			oldonload();
			func();
		}
	}
}


//添加class
function addClass(element,value){
		if(!element.className){
			element.className = value;
		}else{
			newclass = element.className;
			newclass += " " + value;
			element.className = newclass;
		}
}

//隔行变色
function stripeTables(){
	if(!document.getElementsByTagName) return false;
	
	var table = document.getElementsByTagName("table");
	var odd = false,tr;
	for(var i = 0;i < table.length;i++){
		tr = table[i].getElementsByTagName("tr");
		for(var j = 0;j < tr.length;j++){
			if(odd == true){
				addClass(tr[j],"odd");
				odd = false;
			}else{
				odd = true;
			}
		}
	}
}

//鼠标滑过字体加粗
function highlightRows(){
	if(!document.getElementsByTagName) return false;
	
	var table = document.getElementsByTagName("table");
	for(var i = 0;i < table.length;i++){
		tr = table[i].getElementsByTagName("tr");
		for(var j = 0;j < tr.length;j++){
			tr[j].onmouseover = function(){
				this.style.fontWeight = "bold";
			}
			tr[j].onmouseout = function(){
				this.style.fontWeight = "normal";
			}
		}
	}
}


//获取abbr
function displayAbbr(){
	if(!document.getElementsByTagName || !document.createElement || !document.createTextNode) return false;
	
	//获取所有的abbr
	var abbr = document.getElementsByTagName("abbr");
	//定义一个空数组
	var defs = new Array();
	//遍历abbr
	for(var i = 0;i < abbr.length;i++){
		var current_link = abbr[i];
		//获取到abbr的title
		var key = current_link.getAttribute("title");
		//获取到abbr的文本
		var title = current_link.firstChild.nodeValue;
		//添加到数组
		defs[key] = title;
	}
	
	//创建一个ul列表
	var list = document.createElement("ul");
	//循环遍历访问键
	for(key in defs){
		//
		var title = defs[key];
		
		//创建列表项
		var li = document.createElement("li");
		//创建列表文本
		var li_text = document.createTextNode(key + ":" + title);
		li.appendChild(li_text);
		
		list.appendChild(li);
		
	}
	
	var header = document.createElement("h3");
	var header_text = document.createTextNode("Abbreviations");
	header.appendChild(header_text);
	
	document.body.appendChild(header);
	document.body.appendChild(list);
	
}


addLoadEvent(stripeTables);
addLoadEvent(highlightRows);
addLoadEvent(displayAbbr);
            
          
!
999px
Loading ..................

Console