|
mit diesem JavaScript lassen sich sehr einfach Kommentare in Textfeldern erzeugen. Zur Demo mit der Maus auf die markierten Worte klicken.
Autor: Corneliu Lucian Rusu
Demo:
The W3C World Wide Web Consortium develops interoperable technologies specifications, guidelines, software, and tools to lead the Web to its full potential. To achieve the goal of one Web, specifications for the Web's formats and protocols must be compatible with one another and allow (any) hardware and software used to access the Web to work together. Since 1994, the W3C has produced more than ninety Web standards W3C Recommendations.
CSS
.hide {
display: none;
}
.show {
display: inline;
border-bottom: dotted thin;
}
.show2 {
display: inline;
background-color: #FEFF9F;
padding: 0 3px 0 3px;
font-size: .9em;
}
in <head> einfügen
<script type="text/javascript">
// by Corneliu Lucian Rusu anet.ro/zen/
function showhide(s){
while(s.nodeType!=1 && s.nodeName.toLowerCase()!='span'){s=s.nextSibling};
s.className=(s.className=='show2')?'hide':'show2';
return false;
}
//Jeremy Keith domscripting.com/
window.onload=getReady;
function getReady() {
var links = document.getElementsByTagName("a");
for (var i=0; i<links.length; i++) {
if (links[i].className == "show") {
links[i].onclick = function() {
return showhide(this.nextSibling);
}
}
}
}
</script>
in <body> einfügen
The <a name="1" class="show">W3C</a> <span class="hide">World Wide Web Consortium</span> develops <a name="2" class="show">interoperable technologies</a> <span class="hide">specifications, guidelines, software, and tools</span> to lead the Web to its full potential. To achieve the goal of one Web, specifications for the Web's formats and protocols must be compatible with one another and allow (any) hardware and software used to access the Web to work together. Since 1994, the W3C has produced more than ninety <a name="2" class="show">Web standards</a> <span class="hide">W3C Recommendations</span>. |