epolan Posted November 14, 2007 Share Posted November 14, 2007 Hi everyone Just a quick one.. i've created an ajax script to read a content from a php file using innerhtml. Inside the php file, there is a javascript code which is generated using php. The thing is, the javascript code could not be executed when the php file is loaded but when i open the php file itself, the javascript can be execute. Which mean, there is no problem with my javascript. Is there any solution for my problem?? Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted November 15, 2007 Share Posted November 15, 2007 is the javascript in your php file using a onload event? Quote Link to comment Share on other sites More sharing options...
epolan Posted November 15, 2007 Author Share Posted November 15, 2007 yes..the script is in php file but not using onload event. the script is for image gallery where i query from the database. Here's the script in the php file:- <script language="JavaScript" type="text/javascript"><!-- //thumbnail script <? for ($i=0;$i<count($gambar);$i++) { echo "image$i =new Image();\n"; } for ($i=0;$i<count($gambar);$i++) { echo "image$i.src = \"photos/$gambar[$i]m.jpg\"\n"; } for ($i=0;$i<count($gambar);$i++) { echo "document.images['pimage$i'].src=image$i.src;\n"; } for($i=0;$i<count($gambar);$i++){ $caption[$i] = $caption[$i]; ?> function image_click(clicks) { <? for ($i=0;$i<count($gambar);$i++) { echo "if(clicks==$i){ document.images['large'].src=image$i.src; }\n"; } ?> } function LoadGallery(larger,captionText) { document.getElementById(larger).innerHTML=captionText; } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.