jonasjgs2 0 Denunciar post Postado Fevereiro 10, 2012 caros amigos, de inicio me desculpem pela inocencia pois estou aprendendo e sofrendo um pouquinho...rs eu tenho uma funcao php chamada teste() porque na onclick do botao teste nao funciona se a funcao e executada normalmente no <body>? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>teste de funcao</title> <? function teste() { echo "executou"; } ?> </head> <body> <? teste() ?> <------------------- aqui funciona <input type="button" value="teste" onclick="<? teste() ?>" /> <--------- aqui nao funciona porque? </body> </html> Compartilhar este post Link para o post Compartilhar em outros sites
Eduardo Villa 2 Denunciar post Postado Fevereiro 10, 2012 function teste(){ echo "executou"; } echo teste(); OU function teste($string){ return $string; } echo teste('Eduardo'); Compartilhar este post Link para o post Compartilhar em outros sites