...

View Full Version : Execute alert from php function



facets
09-21-2005, 03:13 AM
hey gang..

any ideas on how I could do this without the button?
So i can execute it from calling a php function

<form><input type=\"button\" onclick=\"alert('Done!')\" value=\"Alert\"></form>

_Aerospace_Eng_
09-21-2005, 03:23 AM
PHP is server side. An alert is client side. There is a difference. PHP can echo javascript but javascript CANNOT communicate with php.

facets
09-21-2005, 03:26 AM
sure, i understand that.

so why would this not work?


echo "<script language=\"JavaScript\">alert('Done!')></script>";

_Aerospace_Eng_
09-21-2005, 03:32 AM
Because its an error in your part, notice the red highlight.

echo "<script language=\"JavaScript\">alert('Done!')></script>";
Also you shouldn't use language="JavaScript" you should use type="text/javascript" instead.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum