Consider, I’ve got this code in PHP
<?php
if($count==0)
{
?>
<script>
show_my_div();
</script>
<?php } ?>
the show_my_div() is supposed to show a division tag. But It doesn’t work. Please help.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no standard
show_my_divfunction in PHP or JavaScript. You’d have to post the content of that function for anyone to help you with it.Outputting a div is easy in PHP:
Similarly, it’s easy in JavaScript to create a div element and append it to something. Here’s raw JavaScript to append a div to the end of the page:
You can append elements anywhere, not just at the end. For instance, suppose I have a div with the id
foo:…and I want to add a paragraph to the end of it:
These things are made easier if you use a JavaScript library like Prototype, jQuery, Closure, or any of several others to smooth out browser differences and give you some syntactic sugar.