i want onchange of an option in the dropdown list to change the value of the textarea. I tried but it's not working.

<script type='text/javascript'>
function ChgBox(number) {


var thecontent = document.getElementById(number).innerHTML;
   document.getElementById(content).value = thecontent;	
	
}
</script>
echo "<div style='display:none;' id='2'>Type Image Url</div>";	
			 $thenum ="2";

<select>
  <option value='1' >Your comment on</option>
  <option value='3' >Your question on</option>
  <option value='2' onchange='ChgBox($thenum);'>Your image about</option>
  <option value='0' >Comparison</option>
</select>
<textarea name='content' id='content'></textarea>

You are confusing PHP with JavaScript. I think you want to change the content of the textarea, depending on what option is selected. I think you want something like this:

<script type='text/javascript'>
function ChgBox(number) {


   var thecontent = document.getElementById(number).innerHTML;
   document.getElementById('content').value = thecontent;	
	
}
</script>

<select onchange='ChgBox(this.value);'>
  <option value='1' >Your comment on</option>
  <option value='3' >Your question on</option>
  <option value='2'>Your image about</option>
  <option value='0' >Comparison</option>
</select>

... Some other stuff...

<textarea name='content' id='content'></textarea>

~G

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.