Php echo or print textarea doesn't work with this javascript code?
-
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").innerHTM… = "This should be echoing out, but doesn't"; break; case "test2": document.getElementById("text").innerHTM… = "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.
-
Answer:
onclick="showThis("test1");return false;" You have nested double quotes there. You need to use double outer, single inner, or single inner, double outer quotes. Then you have to make it work with the single quotes for the echo.
bestcraz... at Yahoo! Answers Visit the source
Related Q & A:
- How come CD doesn't work in my shell script?Best solution by Super User
- How to find the embed code for videos on a Website when it doesn't show in the source code?Best solution by Stack Overflow
- Youtube doesn't work on iphone?Best solution by answers.yahoo.com
- Google doesn't work (google.com) on any computer?Best solution by Yahoo! Answers
- Yahoo Music Doesn't Work?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.