hi, i've been trying to call js through php and it's not working, i'm not sure why. i've searched around and i can't figure out what i'm doing wrong. here's my code: if (mysql_num_rows($result) == 1) { echo "aaa<script language=javascript>changeBtn();</script>"; } else { echo "aab<script language=javascript>alert('anything');</script>"; } Code (markup): the aaa and aab show up but no alerts or anything else. thx
You're probably not using quotes properly. Test out the code withOUT the php and get it working first there, then put it in with the PHP and make sure you have proper use of quotes and escaping quotes.
doh! it turns out i was the echo was being sent to a div through innerHTML and that messed it up. i changed it to document.write and now it works, yay!