开发者

opening variable link in new window

开发者 https://www.devze.com 2023-03-14 07:35 出处:网络
I have a wordpress site and one of the plugins pulls school info in to my site.when someone clicks on a school the link is opened on the same page.I would like the link to open in a new window.I have

I have a wordpress site and one of the plugins pulls school info in to my site. when someone clicks on a school the link is opened on the same page. I would like the link to open in a new window. I have tried and broke the site a number of times.

where would i add the blank target to the below snippet of code?

    <h4><a href="{$school["url"]}">{$school["schoolname"]}&开发者_如何学Pythonlt;/a></h4>


<h4><a target="_blank" href="{$school["url"]}">{$school["schoolname"]}</a></h4>


Add the target to the a tag:

<a href="..." target="_blank">...</a>

Also, to be picky, if you're using an XHTML doctype then the target attribute isn't valid and a strict solution would be to do the window opening with Javascript. If you're using an HTML doctype (and why not use the HTML5 doctype?), then it's grand.

0

精彩评论

暂无评论...
验证码 换一张
取 消