Page 1 of 1

i have a small problem with javascript and php...

Posted: Sat May 26, 2012 4:00 am
by mekha
i have an echo that have this code:

echo' <a href="#" id="adher">Click Here</a> ';

now in java script i need to change the "Click here" in another text....how can i ?

i tryed this...
<script type="text/javascript">
function showStuff(id) {
document.getElementById('adher').innerHTML ="<span style='color:green; font-weight:normal;'>The New Text</span>";
}
</script>
in html page its work
but in
php
its not !

Re: i have a small problem with javascript and php...

Posted: Sat May 26, 2012 4:16 am
by pbs
can u please post your PHP code

Re: i have a small problem with javascript and php...

Posted: Sun May 27, 2012 7:28 am
by social_experiment
mekha wrote:in html page its work
I'm not sure if this is helpful but it will work in the html because javascript is processed on the browser (or client side) whereas php has to go to a server (server side) to be processed; if the js code is embedded via php it will work but only if the page is submitted / processed.