Tip

Show Dynamic Text When Changing Fieldvalues

This Javascript function and additional HTML has been redeveloped as utility to
present helptext to the user when he/she is changing a fields value (for
instance a dropdown/check/radio).

For it to work in both Netscape and MSIE, I had to add some dumb non-breaking
spaces.

In the form add the following:

[<div ID="outer1" class="outerstyle"><div id="inner1" class="innerstyle">
             &n
bsp;            &nbs
p;             
             &n
bsp;            &nbs
p;             
             &n
bsp;            &nbs
p;             
             &n
bsp;            &nbs
p;           &n
bsp;            &nbs
p;             
   </div></div>]

Call it from a field using:

onclick or
onchange="updateNestedLayer('outer1', 'inner1',
document.<yourform>.<yourfield>)"

function updateNestedLayer(outer,inner, object) {
var helptext = "";

helptext = "Some help text";
// This help text ca be evaluated by getting the value of object and then
assign the text to
helptext

if (document.layers) {
document.layers[outer].document.layers[inner].document.open();
document.layers[outer].document.layers[inner].document.write(helptext)
document.layers[outer].document.layers[inner].document.close();
}
else if (document.all)
document.all[inner].innerHTML=helptext;
}
}

This was first published in November 2000

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.