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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

beginner: variable in a hidden field

Status
Not open for further replies.

whinger74

Programmer
Aug 13, 2002
25
GB
I am a total beginner to JavaScript, but have coded in VBScript for a while.
I want to get the HTML source code for a file, so that the client can then send it out as a HTML formatted email newsletter.
I used jaredn's great tip in a previous thread, as follows:
<html id=&quot;wholedoc&quot;>
<body onLoad=&quot;allcode=wholedoc.innerHTML&quot;>

I than have a form with a hidden field named fullcode. I simply want to set the value of fullcode to the allcode variable! (should be easy)
When I write:
<input type=&quot;hidden&quot; name=&quot;fullcode&quot; value=&quot;document.write(allcode)&quot;>,

and the form is submitted, the value of fullcode is literally &quot;document.write(allcode)&quot;!!
How do I access this allcode variable?
many thanks in advance
 
Try this:

<html id=&quot;wholedoc&quot;>
<body onLoad=&quot;allcode=wholedoc.innerHTML&quot;>

...
<script>
<!--
document.write('<input type=&quot;hidden&quot; name=&quot;fullcode&quot; value=&quot;'+allcode+'&quot;>');
//-->
</script>

Rick
 
many thanks ristmo! i don't have the brains i was born with...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top