I’ve been stuck on this all day, I have a script I’m working with and it needs a bit of fine tuning. Essentially I need the following function to produce a link (website) but the target must go to a new window (_blank)
function build_content_string(v) {
// build content string
var content_string = "<div class='maps_popup'>";
// include image
if(v.img != '') {
content_string += "<img class='img' src='"+v.img+"' alt='Store Image' />";
}
// include title & address
content_string += "<h1>"+v.name+"</h1><h2>"+v.address+"</h2>";
// include additional info
if(v.telephone != '') {
content_string += "<p class='tel'>Telephone: "+v.telephone+"</p>";
}
if(v.email != '') {
content_string += "<p class='email'>Email: <a href='mailto:"+v.email+"'>"+v.email+"</a></p>";
}
if(v.website != '') {
content_string += "<p class='web'>Website: <a href='"+v.website+"'>"+v.website+"</a></p>";
}
if(v.description != '') {
content_string += "<p class='desc'>"+v.description+"</p>";
}
content_string += "</div>";
return content_string;
}
Let me know what you guys think…
If you want those anchors to go to a new window, add a target to their definitions:
Also, it’s invalid to nest elements like anchors inside of paragraphs. Consider changing those paragraphs to spans or divs.