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

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

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

Post 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 !
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

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

Post by pbs »

can u please post your PHP code
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

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

Post 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.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
Post Reply