Hi,
I am trying to call a Javascript function from a PHP if-else function. The if-else function itself and the else part are working fine, I just can't get the Javascript to run when the if condition is met.
I have tested the Javascipt code by dropping it into a plain html page and there it runs fine.
Would anybode here know what I'm doing wrong??
Thank you,
diederik
Here is the code:
<?php if('the_title'!=="At Random Play") : ?> <?php echo '<div id="flashcontent">
<strong>XML gallery</strong>
</div>
<script type="text/javascript">
var so = new SWFObject("http://www.theblacksnapper.net/wp-content/uploads/2009/random_play_2009/gallery.swf", "", "620", "503", "8", "#ffffff");
so.addParam("allowScriptAccess", "always");
so.addVariable("xmlfile", "http://www.theblacksnapper.net/wp-content/uploads/2009/random_play_2009/xml/images.xml");
so.write("flashcontent");
</script>'; ?> <?php else : ?> <?php echo get('part_flash');?> <?php endif; ?>
I have the sfwobject in my header like this:
<script type="text/javascript" src="http://www.theblacksnapper.net/swfobject.js"></script>