I know some about javascript, but not much with ajax.
This is what I need done. I have a link wraped with php code, I want to use a javascript onclick event with it but I don’t want to make a new link on the page nor do I want to integrate the onlick event by wrapping the link with javascript. It would be to much work for me to take a part and reprogram the php link on the page since it’s saturated with other server side code.
What I want to know and do is some how code a hidden program on the same page that knows when the php link has been clicked and if it has been clicked the code would pop up a second tab url to another page when the browser is loading the php link.
Basically a pop up. I don’t know how to do this without using
Since the php link url will not be placed in the href=“#”. Can ajax be able to know when a separate link has been clicked and onload create a pop up to a separate page?
The script uses the identifier to gain a reference to the link, so that it can then set the onclick event for that link.
function linkClickHandler () {
location.href = 'http://link1.com'; // open in main window
window.open('http://link2.com'); // open in new window/tab
}
var link = document.getElementById('putLinkNameHere');
link.onclick = linkClickHandler;
The script uses the identifier to gain a reference to the link, so that it can then set the onclick event for that link.
function linkClickHandler () {
location.href = 'http://link1.com'; // open in main window
window.open('http://link2.com'); // open in new window/tab
}
var link = document.getElementById('putLinkNameHere');
link.onclick = linkClickHandler;