问题
I want to add a iframe to my website that has a button in it and when someone clicks on it, it does an action like maybe forward to another page or echo a message. I don't care about the code whether its java, php, html, etc as long as it works. I'm good at coding certain things but this is not one of them, help me out please.
UPDATE: the iframe is: iframe src="http://ipget.tk" /iframe
when its clicked on I want it to go to google.com the iframe will be on a test page on scazioco.com
回答1:
Using Jquery you can bind an event to your IFrame :
$('#iframe_id').bind('click', function(event) {
window.location = http://www.google.com
});
Replace #iframe_id with the actual Iframe's ID
来源:https://stackoverflow.com/questions/15509671/detect-click-on-iframe-then-do-an-action