bilis_money Posted October 22, 2007 Share Posted October 22, 2007 let say i have a php function like this below; function myfunc() { etc... } now i have javascript below using onmouover(); <a href="" onmouseover=""> <img src="mypicture.jpg" width="" height="" border="2"/> </a> what is the proper way to insert php myfunc() inside javascript onmouseover() function. So that i can call the php function. is this correct below? <a href="" onmouseover="<?php myfunc(); ?>"> they say it is not possible on javascript but it is possible on ajax. actually i have to call a javascript function plus a php function inside a onmouseover() how i would go about with this? please take note i'm newbie on ajax. Thanks in advance. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted October 22, 2007 Share Posted October 22, 2007 You can't. I don't know how many times this has to be repeated, but Javascript only occurs on the client and PHP only occurs on the server. AJAX is merely a means of invoking a request on the server without refreshing or reloading the current page. The request is made to the server, the server executes some PHP, the PHP spits out some plain text (as it always does), and then your Javascript interprets however you decide it does. I won't explain the process in great detail, here are some pictures to help: http://images.google.com/images?q=ajax+interaction+model&ie=UTF-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a&um=1&sa=N&tab=wi I suggest you step through a couple of AJAX tutorials before you ask further questions about the topic. I would highly recommend researching the different Javascript event models as well. Quote Link to comment Share on other sites More sharing options...
mainewoods Posted October 26, 2007 Share Posted October 26, 2007 function myfunc() { etc... } what does that function do? maybe you can convert it to javascript. 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.