I have a javascript function that works properly when I run it in javascript however I need a php script to run this function when something is true. right now I have it echo'n %26lt;script lang.... function() %26lt;/sci However it seems to echo it but the function never runs?
I want a php script to be able to perform a javascript function?
Hi Amy,
If you want to call Javascript function when user does something on the page then you don't need php for that.
What you need to do is
%26lt;script language="javascript"%26gt;
function foo()
{
//do something
alert("Dharmavirsinh Jhala");
}
%26lt;/script%26gt;
//Now to call this function when user clicks on the button or on-mouse-over event you gotta write following html code.
This html code you can generate using php any way.
%26lt;input type="button" name="buzz" onclick="foo()"%26gt;
that's is you are done with it.
Now if you want this function to call on some mouse over event then do like following example.
%26lt;table%26gt;
%26lt;tr onmouseover="foo()"%26gt;
%26lt;td%26gt;....%26lt;/td%26gt;
%26lt;/tr%26gt;
%26lt;/table%26gt;
Now you can echo/print above code from php easily.
I hope I solved your query.
But still if you have described you query in more detail I would be able to specify your solution more precisely.
still if you have any doubts provide some more details or just mail me on dharmavir@gmail.com or buzz me on dharmavir.jhala@yahoo.com I will be happy to help you out as I am experienced php programmer.
Regards,
Dharmavirsinh Jhala.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment