> Hi guys,
>
> I have this code Javascript code:
>
>       if (document.images) {
>
> img1on = new Image();   img1on.src = "<?php echo $base_url;
> ?>Graphics/<?php echo $img_home_on; ?>";
> img2on = new Image();   img2on.src = "<?php echo $base_url;
> ?>Graphics/<?php echo $img_programdetails_on; ?>";

<snip>

>
> Regards,
>
> Aaron
>

When you mix PHP and javascript together in an external file, the file
needs to be PHP and you should include it with PHP. I just recently went
through this. I had an external javascript file with some PHP in it. It
was originally called into the index.php page as:

<script type="text/javascript" src="includes/links.js">

But none of the PHP in the links.js worked.

So I renamed the file to links.php and called it in index.php like so:

<?php include 'includes/links.php'; ?>

And everything worked perfectly.

-- 
--Matthew Sims
--<http://killermookie.org>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to