Menu
How can I call a PHP function in a <input> tag (in the onClick=…. part)?
[i]Originally posted by mitcon [/i]
[B]Could you maybe work with multiple button images in an Anchor (<a...) tag? Swapping images would probably be trivial. For that matter, changing the procedure associated with an action (onclick, etc.) may be simple as well...I would have to investigate...have you tried it Mr. Novice?[/B][/QUOTE]
<i>
</i><script language="JavaScript" type="text/javascript">
<!--//
function oneFunction() {
}
function twoFunction() {
}
function ctlFunction() {
if (some condition) {
obj.onclick = oneFunction;
} else {
obj.onclick = twoFunction;
}
}
//-->
</script>
[i]Originally posted by phpnovice [/i]
[B]JavaScript can do all of that -- unless you specifically need information from the server-side (in which case, your server-side code could build it into a JavaScript data table when the page is first loaded). You'll not get PHP to dynamically do it (as previously explained why -- unless you want to hear about an IE-only solution that allows JavaScript to call server-side functions). [/B][/QUOTE]
[i]Originally posted by Jona [/i]
[B]That isn't true at all![/B][/QUOTE]
[i]Originally posted by Jona [/i]
[B]JavaScript can send requests to the server in most browsers.[/B][/QUOTE]
[i]Originally posted by phpnovice [/i]
[B]Now, I'm not talking about just sending. I'm talking about two-way communication in an event handler, for example. If this has been implemented in most browsers, I'd like to see what such code looks like. Thanks. [/B][/QUOTE]
<i>
</i>var req = new ActiveXObject("Microsoft.XMLHTTP");
<i>
</i>var req = new XMLHttpRequest();
0.1.9 — BETA 5.5