473,738 Members | 3,636 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript /CSS code accessing DOM objects introduced via PHP include

Hi there,

I wonder if you guys can help.

I'm currently experiencing some coding problems what with trying to use PHP
and javascript in tandem.

What I'm ultimately trying to achieve is use Javascript to access the DOM
objects of any given page within the web site I'm building to dyanamically
resize any and all text elements. I have Javascript some code that works
perfectly when used in isolation via a flat XHTML page however it's when I try
to use that same code in PHP rendered pages where the content derives from a
PHP include, that problems arise and it just doesn't appear to work at all.

So as to explain this ina alittle more detail let me say that my website is
built around a 3 collumn format with a header and footer. With this 3
collumns, you have a left-hand navigation bar and a righ-hand navigation bar.
It is within the middle and largest collumn, that content is displayed.

At the moment, the XHTML for the header and footer is included via a PHP
include. The the 3 central collumns are established via a PHP template and it
is into the middle collum that content is dynamically inserted via yet another
PHP include. These includes either retrive content from a databse lookup of a
MySQL database or from a series of plain text files.

The Javascript code that I spoke of above and which I know works well when
used in flat XHTML pages, is included via the header PHP include code and is
contained within the <head... </headtags. What I want to know is why, if
the Javascript is included in this way, do the functions included in this code
not access and therefore chnage the page elements if these page elements are
introduced via a PHP include?

I can see no obvious reason why this shouldn't work so if anyone has any
suggestions or advice on how to get this to work, I'd be very grateful

Please reply to: wi****@ntlworld .com

Many thanks.

Will

Sep 25 '06 #1
2 1929
William van Zwanenberg wrote:
Hi there,

I wonder if you guys can help.

I'm currently experiencing some coding problems what with trying to use PHP
and javascript in tandem.

What I'm ultimately trying to achieve is use Javascript to access the DOM
objects of any given page within the web site I'm building to dyanamically
resize any and all text elements. I have Javascript some code that works
perfectly when used in isolation via a flat XHTML page however it's when I try
to use that same code in PHP rendered pages where the content derives from a
PHP include, that problems arise and it just doesn't appear to work at all.

So as to explain this ina alittle more detail let me say that my website is
built around a 3 collumn format with a header and footer. With this 3
collumns, you have a left-hand navigation bar and a righ-hand navigation bar.
It is within the middle and largest collumn, that content is displayed.

At the moment, the XHTML for the header and footer is included via a PHP
include. The the 3 central collumns are established via a PHP template and it
is into the middle collum that content is dynamically inserted via yet another
PHP include. These includes either retrive content from a databse lookup of a
MySQL database or from a series of plain text files.

The Javascript code that I spoke of above and which I know works well when
used in flat XHTML pages, is included via the header PHP include code and is
contained within the <head... </headtags. What I want to know is why, if
the Javascript is included in this way, do the functions included in this code
not access and therefore chnage the page elements if these page elements are
introduced via a PHP include?

I can see no obvious reason why this shouldn't work so if anyone has any
suggestions or advice on how to get this to work, I'd be very grateful

Please reply to: wi****@ntlworld .com

Many thanks.

Will
Will,

By the time the client sees your page, it doesn't make any difference
how the page was generated - PHP, Perl, ASP, or static. The browser
never sees any of the scripting code.

You need to look at the source at your browser and determine what's
different between the working and the non-working. Then fix it accordingly.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Sep 25 '06 #2
William van Zwanenberg wrote:
Hi there,

I wonder if you guys can help.

I'm currently experiencing some coding problems what with trying to use PHP
and javascript in tandem.

What I'm ultimately trying to achieve is use Javascript to access the DOM
objects of any given page within the web site I'm building to dyanamically
resize any and all text elements. I have Javascript some code that works
perfectly when used in isolation via a flat XHTML page however it's when I try
to use that same code in PHP rendered pages where the content derives from a
PHP include, that problems arise and it just doesn't appear to work at all.

So as to explain this ina alittle more detail let me say that my website is
built around a 3 collumn format with a header and footer. With this 3
collumns, you have a left-hand navigation bar and a righ-hand navigation bar.
It is within the middle and largest collumn, that content is displayed.

At the moment, the XHTML for the header and footer is included via a PHP
include. The the 3 central collumns are established via a PHP template and it
is into the middle collum that content is dynamically inserted via yet another
PHP include. These includes either retrive content from a databse lookup of a
MySQL database or from a series of plain text files.

The Javascript code that I spoke of above and which I know works well when
used in flat XHTML pages, is included via the header PHP include code and is
contained within the <head... </headtags. What I want to know is why, if
the Javascript is included in this way, do the functions included in this code
not access and therefore chnage the page elements if these page elements are
introduced via a PHP include?

I can see no obvious reason why this shouldn't work so if anyone has any
suggestions or advice on how to get this to work, I'd be very grateful

Please reply to: wi****@ntlworld .com

Many thanks.

Will
Will,

If you aren't already using Firefox, try doing so as it has a wonderful
JavaScript debugger, that should at least give you an idea of what might
be going on.

Just make sure that your browser source is displaying the included lines
of Javascript, if it is then there must be an error occuring and the
debugger will help.

Regards

Q.
Sep 25 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9335
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6751
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6053
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4570
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.