By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,985 Members | 1,863 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,985 IT Pros & Developers. It's quick & easy.

onload() with PHP

P: n/a
Ben
I have a question about onload() with PHP.

my <body> tag in a file call "header.php"

my files construct like this.

header.php
<body>
<table>...

content.php
include('header.php');
contents... line 1 ...
contents... line 2 ...
contents... line n ...
include('footer.php');

footer.php
</table>
</body>

Question
knowing that onload() is used in <body> tag.
is it possible to have my onload() written in content.php?
if so, how can I do it?

Thank you very much!
Jan 16 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Ben wrote:
I have a question about onload() with PHP.

my <body> tag in a file call "header.php"

my files construct like this.

header.php
<body>
<table>...

content.php
include('header.php');
contents... line 1 ...
contents... line 2 ...
contents... line n ...
include('footer.php');

footer.php
</table>
</body>

Question
knowing that onload() is used in <body> tag.
is it possible to have my onload() written in content.php?
if so, how can I do it?

Thank you very much!


If you want to be able to control which function is called and/or
written, you could try something like this:

header.php:
echo "<body onload='" . $jsFunction . "'>";
// note that's equal/single-quote/double-quote after the 'onload'

content.php:
$jsFunction = "javascriptFunctionName()";
include('header.php');

And as mentioned, any further discussion would better be done in a PHP
group, where you'll get more help on structuring the PHP, which is
probably more relevant to your needs.

Jan 16 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.