473,698 Members | 2,796 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 1926
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
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
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
8901
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
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7739
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
6528
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
4622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2336
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.