function edit_bookmark(event) { window.open(this.href, 'edit_bookmark', 'width=800,height=250').focus(); event.preventDefault(); return false; } var bookmark_links = document.querySelectorAll('.edit-bookmark'); for (var i = 0; i < bookmark_links.length; i++) { bookmark_links.item(i).addEventListener('click', edit_bookmark); }