Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

3 of 3 people (100%) answered Yes
Recently 3 of 3 people (100%) answered Yes

Entry

How i can use java script variables in html text field

Apr 8th, 2008 18:49
ha mo, Dave Clark, Raed Alasby,


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Raed,
     You cannot do that directly, of course, but there are no limits 
to what you can do with DHTML in this area.  I don't know the specific 
scenario you had in mind, but there are at least two ways to 
accomplish the insertion of JavaScript information into an HTML 
element.
     The first method can only be used during the initial load of the 
document:
<div>
  <script type="text/javascript">
  <!--//
  document.writeln(javascript_info);
  //-->
  </script>
</div>
     The second method can be used at any time -- either during inital 
load of the document or not.  This is the arrangement for initial 
document load:
<div id="dyna_div"></div>
<script type="text/javascript">
<!--//
document.getElementById('dyna_div').innerHTML = javascript_info;
//-->
</script>
     Using the same method after document load merely requires that 
you place that line of code into a function and have the function 
driven by some DHTML user event.
Take care,
Dave Clark
www.DaveClarkConsulting.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com