15 October 2007

Javascript : Hide/Show Text

Two weeks ago, I managed to write a simple javascript function with the help of Eva. The aim of the classroom tutorial was to solve out how to show and hide more text in a document.

I made an external file and below shows the script:


// JavaScript Document// Expand text- one shot.
function et(rID){
if (document.getElementById){
var tID1 = document.getElementById(rID+1);
if (tID1.className == "ex") {
tID1.className = "ux";
}
else {
tID1.className = "ex";
}
}

}


The follow code below shows the html document: (note that I did not make another seperate external CSS file, so I just wrote it in the head.


[head]
[]
[body]


show hide


(approx. 200K compresses to approx. 25k) The content is first edited in Tiddlywiki, then an HTML export of the content is written to a file. My parser processes this file further, as well as integrating it into other HTML fragments.

-->

No comments: