mercredi 22 juillet 2015

Multiple window.open pages

I have a javascript function that is like this assigned to an input submit

function choose () {
if(document.getElementById("first").checked) {
    window.open("http://www.facebook.com", '_blank');
}
if(document.getElementById("second").checked) {
    window.open("http://www.twitter.com", '_blank');    
}
if(document.getElementById("third").checked) {
    window.open("http://www.linkedin.com", '_blank');   
} }

In fact I want the browser to open ONE new window if the first checkbox is checked, or to open TWO new windows if both first and second are checked, etc..

But if I check both first and second checkboxes the browser only open the first link. What's the problem?




Aucun commentaire:

Enregistrer un commentaire