Forum Moderators: open

Message Too Old, No Replies

Likely the Simplest Queston Ever

Javascript for including a PHP file?

         

sailorjwd

1:58 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to get my php script which switches between two advertisements to be included in an HTML file.

Is this possible? (note that I cannot rename files to shtml)

I'm running on a windows server and here is the javascript command:

<script language="javaScript" src="test.php"></script>

The test.php script runs fine when invoked directly.

When the html file is loaded nothing happens.

Bernard Marx

2:48 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That will treat the output of your PHP page as Javascript.

sailorjwd

3:00 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Bernard,

Thanks for the reply.

I guess the question is - is it possible and how do I get a PHP script to run from within a .html file?

Bernard Marx

3:13 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This isn't a client-side issue.
What does the PHP script do?

sailorjwd

3:15 pm on Oct 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The php script generates a random number and if =0 it displays Adsense ads and if = 1 it displays Yahoo ads.