DHTML Lab - DHTML Diner - IE4: Toggling TITLE Value Display | 3
| home / experts / dhtml / diner / titletog |
This is an Internet Explorer 4 technique. The in-page examples will only work in Explorer 4 Windows and Explorer 4 Macintosh. |
Toggling the Display of TITLE Values TITLE= as a Scripting Property <P ID="samplePara" TITLE="This is a paragraph"> We can retrieve the value of title, and store it in a variable, in this way: variableName = samplePara.title; To assign a new value to title, we simply provide a new replacement string: samplePara.title = "new string to display"; If you are using Explorer 4, click the following button to assign a new title value to the paragraph above, then pass your mouse over it again: Toggling title Values
The complete script looks like this: isTips = true; arTitled = new Array(); for (i=0;i<document.all.length;i++) {
elT = document.all(i);
if (elT.title) {
arTitled[arTitled.length] = elT;
elT.tooltip = elT.title;
}
}
function togTips(){
isTips = !isTips;
for (i=0;i<arTitled.length;i++) {
elT = arTitled[i];
elT.title = (isTips) ? elT.tooltip : "";
}
}
We discuss it step-by-step on the final page. |
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: Sept 14, 1998
Revised: Sept 14, 1998
URL: http://www.webreference.com/dhtml/diner/titletog/titletog3.html



