Help - Search - Members - Calendar
Full Version: Passing variables from Javascript to html
HTMLHelp Forums > Programming > Client-side Scripting
AAS Kicker
Hi Guys 'n Girls,

I have written some Javascript that interprets a UK postcode supplied by the client and then calculates the number of British birds that overfly that area (say, for the sake of arguement, it's 25).

I want to write some xhtml that says: "There are 25 birds that overfly your garden" (although, of course, it may be a different number at a different postcode). How do I pass this variable from Javascript to xhtml and then display it?

In case it's not obvious I've only just started writing code.

Regards

Christian J
You can use innerHTML, change a text node with the DOM, or change an existing form field's value.

You might also write new content with document.write(), but that's not permitted in proper XHTML.
AAS Kicker
QUOTE(Christian J @ Oct 18 2009, 06:20 AM) *

You can use innerHTML, change a text node with the DOM, or change an existing form field's value.

You might also write new content with document.write(), but that's not permitted in proper XHTML.


AAS Kicker
Thanks for pointing me in the right direction - I'll try a few examples and, hopefully, I won't need to bother anyone about this topic again.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.