PDA

View Full Version : Call javascript function inside PHP



NovemberRain
October 8th, 2006, 06:35 AM
Hi,
I've a code something like this

<div id="middle" class="clearfix">
<div id="splash"><a title="<?php bloginfo('name'); ?>" href="<?php bloginfo('url'); ?>"><img src="http://www.walkingshadow.in/wp-content/themes/default/images/splash.gif (http://www.walkingshadow.in/wp-content/themes/default/images/splash.gif)" width="568" height="118" border="0" alt="<?php bloginfo('description'); ?>"/></a></div>
<?php get_sidebar(); ?>
<div id="content">

Don't look at the details of the code. I simply need to call a javascript function showImage(); instead of the red color text to rotate (showing different images on each refresh) the image. Javascipt is on top of the page and that return all values correctly. But my code is not working.

Any help will really appreciable.

zerokilled
October 8th, 2006, 01:01 PM
you can use PHP for that purpose. most web developer will tell you that javascript can't be executed in server side. but i must recall that is false, you can execute javascript in server side with the aid of a module (http://users.skynet.be/saw/wxJS/) for the web server, but in this case, apache. however, no matter which language you use, you can aim the same effect. so, why using javascript instead of PHP if you already working on PHP?