how to fill a div text from text on a form both on load and change of text in form

i came across this code
<div id=a>Filled with text</div>

<div id=b onclick="document.getElementById('a').innerHTML='Some Text'">Click Me</div>
how do i get it to change from my form text (upon load and upon change)

          <input   size="36" maxlength="35" value="<?php echo $Manufacturer;?>" name="Manufacturer" onChange="updatePicLink('')">

how do i put all this together

thank you in advance for any code and help you may provide.
JohnnyAsked:
Who is Participating?
 
steveberzinsCommented:
ok, so, you have a div, that you want to change to what is in the Manufacturer textbox, when the page loads, and anytime the Manufacturer textbox value changes? why change it, if you can just set it the same on the server...?

something like:

<div id="a"><?php echo $Manufacturer;?></div>
<input value="<?php echo $Manufacturer;?>" name="Manufacturer" onChange="document.getElementById('a').innerHTML=this.value;" size="36" maxlength="35">
0
 
brunoCommented:
i'm not sure i understand exactly what you want to happen, can you elaborate?
0
 
gops1Commented:
Probably this is what you are looking for:

<html>
      <head>
            <head>
                  <title>Script Demo Gops</title>
                  <script language="javascript">
                        window.onload=function(){
                              updatePicLink(document.forms['test'].elements['Manufacturer'].value)
                        }

                        function updatePicLink(v){
                              var o=document.getElementById('a');
                              o.innerHTML=v;
                        }
                  </script>
            </head>
<body>
      <div id="a"></div>
      <br>
      <form name="test">
            <input name="Manufacturer" type="text" value="Manufacturer" onChange="updatePicLink(this.value)">
      </form>
</body>
</html>
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
JohnnyAuthor Commented:
steveberzins is what im looking for kinda



im trying to show the value of the manufacturer value to the div as it loads and changes..so we have the onload part with the php statement(duh shoulda thought of that myself)

now the string we have is printing out
document.demoform.Manufacturer.value
as the text and not the value.. if we get this part fixed where all set. by the way the line has to have the updatepic too
so it read right now as
          <input   size="36" maxlength="35" value="<?php echo $Manufacturer;?>" name="Manufacturer" onChange="document.getElementById('a').innerHTML=this.value; updatePicLink('')">

thanks so far for the help and suggestions
0
 
JohnnyAuthor Commented:
duh it does work i had the statement in the updatepic i was trying to get to work...forgot that one

so it does work thanks again
accepting steveberzins as answer as his was not only the one i used but the first working answer
0
 
JohnnyAuthor Commented:
heres my final code snips so others can see how it works

<script language="JavaScript" type="text/javascript">
function updateDiv() {
document.getElementById('a').innerHTML = "Current Product - <?php echo $ID;?>: " + document.demoform.Manufacturer.value + ", " + document.demoform.Type.value;
}
</script>


          <input size="36" maxlength="35" value="<?php echo $Manufacturer;?>" name="Manufacturer" onChange="updateDiv(''); updatePicLink('')">



 <div align="left" id=a>Current Product - <?php echo$ID;?>: <?php echo $Manufacturer;?>, <?php echo$Type;?></div>
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.