How to call a php-function by using onclick-event?
How can I call a php-function by using the onclick-event?
Thanx for help.
Thomas
You can't PHP is serverside and javascript (onclick) is client side.
Example:
<a href="index.php" onclick="document.write('functions.php')">TEST</a>
Thanx for help,
Thoaren
Perhaps you don't need AJAX (depends on your prblem) Probably you can do it by invoking (submit0 another page?
I mean: why you need a client-side event for PHP?
When clicked on one of the menu-items, header.php and the corresponding page from the menu is been included in index.php.
This a will not change.
So this is the situation description:
*index.php:
-includes header.php
-includes corresponding page from de menu in header.php
-includes footer.php
*header.php with menu
*corresponding pages, let's say: page01.php and page02.php
This I will not change.
Now I want to change the backgroundimage of a cell in the menu when the corresponding page, let's say page02.php is loaded in the index.php. The backgroundimage of the other menu-items must be change to standard then. I want to do the same when page01.php is loaded in index.php. Also the backgroundimage of the other menu-items must be change to standard then.
Thanx for help.
Thoaren
<script>
function BackToNormal() {
document.getElementById('name1').style.background='url(normal.gif) no-repeat;';
document.getElementById('name2').style.background='url(normal.gif) no-repeat;';
document.getElementById('name3').style.background='url(normal.gif) no-repeat;';
}
function LoadNewImage(element, url) {
element.style.background='url(' +url+ ') no-repeat;';
}
</script>
<something id="name1" onClick="BackToNormal(); LoadNewImage(this, 'something.gif');">
<something id="name2" onClick="BackToNormal(); LoadNewImage(this, 'somethingelse.gif');">
Just be smart with the names and Javascript functions. This was just an example.
Of zijn we internationaal gegaan en heeft niemand me wat verteld?
Hij begon in het engels ;)
Quote:
Hi Erik,
You posted on:http://www.phphulp.nl/forum/showtopic.php?cat=7&id=16372&page=
I explaned my situation now.
Can you please help me out with this?
Thanx,
Thoaren
p.s.: Ik spreek ook nederlands.
You posted on:http://www.phphulp.nl/forum/showtopic.php?cat=7&id=16372&page=
I explaned my situation now.
Can you please help me out with this?
Thanx,
Thoaren
p.s.: Ik spreek ook nederlands.
Alleen sinds wanneer heet ik Erik??
Dan kan ie dat mooi doen dan :P
Het is de macht der gewoonte.
Kan iemand mij helpen met deze topic?
Groeten,
Thoaren