English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

if I replace alert with document.write - this doesnt work - Enter 89146 in the txt box




Enter Zip:




2006-11-27 21:29:33 · 2 answers · asked by kj 2 in Computers & Internet Programming & Design

2 answers

document.write cannot change a document that has already been loaded in the browser. You could instead use DOM scripting to update the content of a page.

In the example above, after the insert the following line:



Now you can append content to this by using DOM manipulation, so instead of
tmpStr += this.city + " " + this.state +
" " + this.zip + "\n" + "
";
do this instead:

var d = document
var el = d.getElementById("output");
el.appendChild(
d.createTextNode(
this.city + " " +
this.state + " " +
this.zip + "\n")
);
el.appendChild(
d.createElement("br")
);

2006-11-27 22:10:22 · answer #1 · answered by Isofarro 3 · 1 0

What dropdown? There is none on the form. There are no text boxes for width and length either. And why eval()? Tell the user to enter numbers if the entry isn't a number.

2016-05-22 21:49:25 · answer #2 · answered by Michelle 4 · 0 0

fedest.com, questions and answers