Php echo or print textarea doesn't work with this javascript code?

bestcrazygames

New member
Ok I am not understanding this at all. It works when it is in html formate, but when I echo or print it in php it doesn't work. Here is the code modified a bit for security reasons. Can you tell me what is wrong with the coding or why its not working.

Here is the javascript and the divs.

<script language="javascript">
var showThis = function(caller){
switch(caller){
case "test1":
document.getElementById("text").innerHTML = "This should be echoing out, but doesn't";
break;
case "test2":
document.getElementById("text").innerHTML = "What ever else";
break;
default:
break;
}
}

</script>

<div class="slide" style="width:100%;background-color:#CCC">
<div id="text">
Here is suppose to echo what ever I put in the javascript

</div>

</div>

This php code is in if else statement, but it is echoed out. To save some time and effort I will just echo out the textarea within the php.


<?php

echo'<textarea id="table1" name="table1" style="width:60%" rows="1" onclick="showThis("test1");return false;"></textarea>';

?>

Here is the textarea in html form that works
<textarea id="table1" name="table1" style="width:60%" rows="1" onclick="showThis('test1');return false;"></textarea>


So if you can tell me why this is working though with the normal html, but not working with php code echoing or printing it out. Or maybe its the javascript coding or the div I would appreciate it very much.
I have tried this this in the php code


I have tried this, and I don't know why my code got deleted.
 
Back
Top