Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does this document.write not work??

Status
Not open for further replies.

Oxymoron

Technical User
Dec 17, 2000
168
GB
I've been making this page, and I cannot figure out y this doesn't work. It works when I use 3 or so input's..but not as many as I have below!
I know it's long, but if anyone could help, I'd be greatly indetted to them! Thanx :p!

<html>
<script language=&quot;VBScript&quot;>
function updatePage()
name.innerHTML = document.game.name.value
best.innerHTML = document.game.best.value
inches.innerHTML = document.game.inches.value
crush.innerHTML = document.game.crush.value
celebrity.innerHTML = document.game.celebrity.value
instrument.innerHTML = document.game.instrument.value
body.innerHTML = document.game.body.value
verb.innerHTML = document.game.verb.value
fav_band.innerHTML = document.game.fav_band.value
dis_band.innerHTML = document.game.dis_band.value
fav_sup.innerHTML = document.game.fav_sup.value
fav_song.innerHTML = document.game.fav_song.value
end function
</script>

<FORM name=&quot;game&quot;>
name <input type=&quot;text&quot; name=&quot;name&quot;><BR>

best friend's name <input type=&quot;text&quot; name=&quot;best&quot;><BR>

a random No. <input type=&quot;text&quot; name=&quot;inches&quot;><BR>

your crush's/girlfriend's/boyfriend's name <input type=&quot;text&quot; name=&quot;crush&quot;><BR>

a celebrity's name<input type=&quot;text&quot; name=&quot;celebrity&quot;><BR>

choose an instrument <select name=&quot;instrument&quot;><br>
<option>guitar
<option>drum
<option>bongo
<option>maracca
<option>bass
<option>banjo
<option>piano
<option>whistle
<option>dijeridoo
<option>recorder
<option>flute
<option>microphone
<option>deck
<option>spoon
<option>voilin
</select>
<br>
a body part <input type=&quot;text&quot; name=&quot;body&quot;><BR>

a verb ('ed..e.g kickED) <input type=&quot;text&quot; name=&quot;verb&quot;><BR>

your favourite band <input type=&quot;text&quot; name=&quot;fav_band&quot;><BR>

your most despised band <input type=&quot;text&quot; name=&quot;dis_band&quot;><BR>

your favourite member of Suppers Ready choose an instrument <select name=&quot;fav_sup&quot;><br>
<option>Tom Holmes
<option>Tom Briton
<option>Tom Jordon
<option>Ben Harvey
<option>Ali Brais
</select>
<br>
your favourite song EVER! <input type=&quot;text&quot; name=&quot;fav_song&quot;><BR>

<Input type=&quot;BUTTON&quot; Value=&quot;Go!&quot; onClick=&quot;updatePage()&quot;>
</form>


<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>

<body>
One day
<span ID=&quot;name&quot;></span> was invited to go to a gig by their mate
<b><span ID=&quot;best&quot;></span></b>.
It was to go and see this AMAZING new band called Suppers Ready, who were being supported by
<b><span ID=&quot;fav_band&quot;></span></b>.
Of course
<b><span ID=&quot;name&quot;></span></b> said they'd be delighted to go!...so they did.
<br>
On the journey there, they found a
<b><span ID=&quot;instrument&quot;></span></b> ,just casually left on the bus. So
<b><span ID=&quot;name&quot;></span></b> and
<b><span ID=&quot;best&quot;></span></b>
picked it up.
<br>
Anyway, they reached the gig venue, and were overwhelmed by the sheer number of fans there for Suppers Ready (and of course one or two die hard fans of
<b><span ID=&quot;fav_band&quot;></span></b> wandering around, trying not to give in to the overwhelming desire to follow Suppers Ready).............(they gave in eventually)
<br>
Well, after Suppers Ready had done most of their set,
<b><span ID=&quot;name&quot;></span></b> was just thinking it couldn't get any better........when
<b><span ID=&quot;fav_sup&quot;></span></b> announced they were just about to play
<b><span ID=&quot;fav_song&quot;></span></b>.
<br>
Well
<b><span ID=&quot;name&quot;></span></b> and his mate
<b><span ID=&quot;best&quot;></span></b> were so chuffed they both jumped, moshed and accidentaly
<b><span ID=&quot;verb&quot;></span></b>
<b><span ID=&quot;celebrity&quot;></span></b> who had heard of Suppers ready through and had decided to come along and see for themselves what they were like.
<br>
As the evening grew to a close
<b><span ID=&quot;name&quot;></span></b> and
<b><span ID=&quot;best&quot;></span></b> felt they had had a jolly good night, and decided to finish it off they'd like to get Suppers ready's autographs.
So they went back-stage....only to find
<b><span ID=&quot;fav_sup&quot;></span></b> with
<b><span ID=&quot;celebrity&quot;></span></b>, who was helping
<b><span ID=&quot;fav_sup&quot;></span></b> hold the
<b><span ID=&quot;instrument&quot;></span></b>
<b><span ID=&quot;inches&quot;></span></b> inches up their
<b><span ID=&quot;body&quot;></span></b>!!!
<br>
Well, after
<b><span ID=&quot;name&quot;></span></b> and
<b><span ID=&quot;best&quot;></span></b> had, had a good laugh about this (having still gotton the autographs they wanted), they decided to walk home. As it was a charming evening
<b><span ID=&quot;name&quot;></span></b> met up with
<b><span ID=&quot;crush&quot;></span></b> and they all helped to crowdsurf
<b><span ID=&quot;dis_band&quot;></span></b> over the road into oncoming traffic.


</body>
</html>
 
From the looks of it, you are using client-side VBScript. I suggest you use JavaScript cause you'll have more cross-browser compatibility. Anyway, I haven't used client-side VBS, but I know server-side uses Response.Write, and not document.write. JavaScript, however, does use document.write. Are you sure you're not mixing it up? That'd be my guess. Replace the &quot;script=vbscript&quot; with &quot;script=javascript&quot; and then replace the function call with this:

function updatePage(){
...
return true
}

That may help. Hope so. Good luck. ~[ cid ]~

web // email // cid@ciddivine.com
aim // ciddivine
 
Looks like you are confusing the page by giving the same names to the span tags as you are giving to the form elements. It doesn't seem like that should really make a difference (at least to me), since the name of the form is an element of the form object, and the name of the span is an element of the document object...

but when I named your name span as &quot;name1&quot;, and then just changed it up there where you ask for:

name.innerHTML

to

name1.innerHTML

it worked fine.

good luck! :)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top