Javascript in if-else function not working
-
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,
diederikHere 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("https://www.theblacksnapper.net/wp-content/uploads/2009/random_play_2009/gallery.swf", "", "620", "503", "8", "#ffffff"); so.addParam("allowScriptAccess", "always"); so.addVariable("xmlfile", "https://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="https://www.theblacksnapper.net/swfobject.js"></script>
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Javascript in if-else function not working’ is closed to new replies.