Is it possible to access the DOM for DHTML control with PHP?
Posted: Tue Jan 14, 2003 6:49 pm
I expect that I really need to give more background on this question, but...
I am curious if there is a way to access the Document Object Model (DOM) in IE or Netscape via PHP native scripting in order to facilitate dynamic page generation such as is available in JavaScript or VBScript (see Example 1 below). Actually, the problem isn't just accessing the DOM from within PHP scripting, but being able to reference a PHP script from within a HTML tag as indicated in Example 2 as well.
Example 1:
/* from within a 'strict' DTD HTML/DHTML/XHTML page */
<?php
// some script here defining the function
// try setting the object color property
document.getElementByID("MyAnchorTag").style.color = "red";
// some script here closing out the function
?>
-- This should change the color of the anchor tag text to red, but instead I can't use this syntax becuase it can't recognize what document.xxx means. --
I need a way to do Event Handling inside a 'strict' DTD. Currently I have PHP pages (like index.php) which handle initial requests to the server, but I can't do DHTML like control from within PHP without mixing JavaScript or VBScript (client or server side) to handle the dynamic elements of the page [even something as simple as Anchor color links on a 'mouseover' event].
The World Wide Web Consortium (W3C @ http://www.w3c.org) discuss a great deal about the standard Document Object Model that browsers are supposed to (and in general do) support. I just can't find a way to access this DOM from within PHP scripts.
Anyone have any advice? How can this be accomplished from within PHP without having to rely on other scripting languages like JavaScript or VBScript? Also, anyone have any samples of PHP Event Handling code?
I am looking for something that allows me to do something like the following:
Example 2:
<img id=myimg name=myimg width="100" height="100" _&
onmousedown="myPHPScriptedEventHandler(myParameters)" _&
src="../images/example.gif" alt="clickable image">
Anyone had sucess with this sort of thing yet?
Thanx ahead of time for the assistance.
-Westmo
I am curious if there is a way to access the Document Object Model (DOM) in IE or Netscape via PHP native scripting in order to facilitate dynamic page generation such as is available in JavaScript or VBScript (see Example 1 below). Actually, the problem isn't just accessing the DOM from within PHP scripting, but being able to reference a PHP script from within a HTML tag as indicated in Example 2 as well.
Example 1:
/* from within a 'strict' DTD HTML/DHTML/XHTML page */
<?php
// some script here defining the function
// try setting the object color property
document.getElementByID("MyAnchorTag").style.color = "red";
// some script here closing out the function
?>
-- This should change the color of the anchor tag text to red, but instead I can't use this syntax becuase it can't recognize what document.xxx means. --
I need a way to do Event Handling inside a 'strict' DTD. Currently I have PHP pages (like index.php) which handle initial requests to the server, but I can't do DHTML like control from within PHP without mixing JavaScript or VBScript (client or server side) to handle the dynamic elements of the page [even something as simple as Anchor color links on a 'mouseover' event].
The World Wide Web Consortium (W3C @ http://www.w3c.org) discuss a great deal about the standard Document Object Model that browsers are supposed to (and in general do) support. I just can't find a way to access this DOM from within PHP scripts.
Anyone have any advice? How can this be accomplished from within PHP without having to rely on other scripting languages like JavaScript or VBScript? Also, anyone have any samples of PHP Event Handling code?
I am looking for something that allows me to do something like the following:
Example 2:
<img id=myimg name=myimg width="100" height="100" _&
onmousedown="myPHPScriptedEventHandler(myParameters)" _&
src="../images/example.gif" alt="clickable image">
Anyone had sucess with this sort of thing yet?
Thanx ahead of time for the assistance.
-Westmo