Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > onload() with PHP

Reply
Thread Tools

onload() with PHP

 
 
Ben
Guest
Posts: n/a
 
      01-16-2006
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!


 
Reply With Quote
 
 
 
 
Lee
Guest
Posts: n/a
 
      01-16-2006
Ben said:
>
>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!


The onload handler that you define in your <body> tag will not
be executed until the entire body has loaded, so any functions
that it called can safely be defined in the body.

If that doesn't answer your question, you might want to ask in
a PHP newsgroup.

 
Reply With Quote
 
 
 
 
Tony
Guest
Posts: n/a
 
      01-16-2006
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Training Institute In Delhi, Live Projects on PHP. Short TermPHP Courses, PHP Scripts, PHP Training with Live Projects. Rajive Narain Java 0 09-18-2009 10:47 AM
Best site for freelancer work (PHP, Web site, java, oracle sql, php,data entry) raviraj joshi NZ Computing 0 07-04-2009 03:05 PM
Learn how to edit php pages with free php editor torque63 HTML 0 01-01-2009 03:45 AM
RE: php and python: how to unpickle using PHP? Ted Zeng Python 0 10-13-2006 12:11 AM
php and python: how to unpickle using PHP? Ted Zeng Python 4 10-03-2006 03:07 PM



Advertisments