April 24, 2011, 06:23 PM
mark66[SOLVED] How to dynamically change text on HTML page?
Hi,
I want to toggle a text label value on my form. I thought it would be a simple case of setting its value, but that does not appear to work?
Example:
function button1_onclick(ctrl) {
document.getElementById('text1').value = "Changed";
}
Using Dev Studio 7611.
Thanks
Mark
This message has been edited. Last edited by: Kerry, April 24, 2011, 09:59 PM
WazThat depends on what type of object on the form you are trying to change.
April 25, 2011, 03:52 AM
mark66Hi Waz,
Its a text label created from the Composer:
<SPAN id=text1 style="Z-INDEX: 1; LEFT: 120px; WIDTH: 300px; POSITION: absolute; TOP: 20px; HEIGHT: 50px" tabIndex=1 persistentuniqueid="compUid_2">Original</SPAN>
Cheers
April 25, 2011, 05:20 AM
<JG>quote:
document.getElementById('text1').value = "Changed";
Not .value use .innerHTML
document.getElementById('text1').innerHTML = "Changed";
April 25, 2011, 05:50 PM
WazAlso be careful with innerHTML, it may not work on all browsers.
April 26, 2011, 03:57 PM
mark66Hi JG, Waz,
Our uses just use IE and .innerhtml does the trick!
Thanks for your help,
Mark