473,326 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

onload() with PHP

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
1 41061
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Pai | last post by:
hello there, I am trying to rersize the window it works find in IE but doea not work with mozilla window.attachEvent(onload,MWSOnLoad); window.onload = function (MWSOnLoad) { alert('hello');...
6
by: Brian | last post by:
Hi everyone, I'm writing a function (in javascript) that needs to do one thing if the page has not loaded, and another (different) thing if the page has already loaded. I'm looking for a way...
4
by: David Virgil Hobbs | last post by:
My web host inserts banner ads into my html pages. The javascript in these banner ads interferes with the onload triggered javascript functions in my pages. Whether I trigger my javascript...
10
by: berg | last post by:
I'm trying to use the onload event to load a series of urls. What I find is that the onload function is only called one time no matter how large the array. Here is the onload function. var...
3
by: Liming | last post by:
Hi, Here is my situation. I have a textarea on the page. When the page loads, I need it to have some default text (which will be generated dynamically) so I did something like this ...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
4
by: PJ6 | last post by:
Say I have serveral controls, all of which need to emit clientside script to execute on page load. They can't emit to OnLoad = <functionname> because then only one of the scripts will get executed....
3
by: Andrew Poulos | last post by:
I've been asked to add some additional code to HTML that get generated by a 3rd party program. Currently the code that gets generated already includes a window.onload = init; The program lets...
20
by: Mark Anderson | last post by:
Hi, I have this in an external JS library: ///////////////////////// function addMyEvent(){ var obj; if(document.attachEvent) { obj = document.getElementsByTagName('img'); for...
1
by: zebra242 | last post by:
I'm working to get the onLoad function of a javascript to work: the script allows form buttons in html to refer to labeled frames in flash. Which works fine. Now I want to add onLoad...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.