Sign in to follow this  
GameMasterXL

[web] Accessing html in php

Recommended Posts

GameMasterXL    100
Hi i am trying to change the innerText property of my td tag in php but i just cannot find a way to do this. If i use javascript the code gets printed out were my link is and nothing is executed. What can i do?

Share this post


Link to post
Share on other sites
Supaflyfrank    152
Well I believe that the only way to change the innerText property is by using javascript. Using php to change it would only change the initial value which you could do with out php just setting the property when the page loads. But if you have to change using php if you want to value to be dynamically set. I think it would go something like this

<script type="text/javascript">
<?php
$dynamicvalue // set it to what ever value you want
echo "document.getElementById("element").innerText = \"$dynamicvalue\";";
?>

</script>

You change element to how ever you identify the specific tag. And you just got to load this javascript code when the webpage starts by what ever means you want to do this.

Just remember that php only manipulates on the server side so after the html is loaded in the browsers there is no way to manipulate the webpage further by using php

Share this post


Link to post
Share on other sites
Cygnus_X    359
There are tons of ways to screw up javascript code... it may be best if you post what you have written and let us disect it. In the <body> tag are you doing an onLoad command? Stuff like that is easy to miss.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this