You are here: irt.org | FAQ | DHTML | Q918 [ previous next ]
The following will work in Netscape Navigator 4 and Internet Explorer 4:
<script language="JavaScript"><!--
function changeContent(id,text) {
if (document.all)
document.all[id].innerHTML = text;
else if (document.layers) {
document.layers[id].document.open();
document.layers[id].document.write(text);
document.layers[id].document.close();
}
}
//--></script>
<form>
<input type="text" name="fieldName">
<input type="button" value="Change" onClick="changeContent('firstname',this.form.fieldName.value)">
</form>
<div id="firstname"><layer id="firstname">xyz</layer></div>