homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Pop-Up Window

5+ Year Member

Msg#: 4325543 posted 4:54 pm on Jun 13, 2011 (gmt 0)

Hi there...

I am NOT an HTML expert, so I will appreciate any/all input. I would like to have the follokwing social site links (code) pop-up in a new window when visitors click on them (currently it goes straight to Facebook, Twitter, etc):

<div id='header-wrapper'>
<b:section class='header' id='header' maxwidgets='1' showaddelement='no'>
<b:widget id='Header1' locked='true' title='Mycitycorona.com (Header)' type='Header'/>
</b:section><div id='headertw'>
<a expr:href='data:blog.homepageUrl + &quot;feeds/posts/default&quot;'><img src='http://4.bp.blogspot.com/-4_p-xRCR5VE/TeYeMwLwqEI/AAAAAAAACRI/gmIPrENEaf4/s1600/rss.png'/></a> <a href='http://twitter.com/mycitycorona'><img src='http://1.bp.blogspot.com/-L2uD0kzKJ50/TeYeNqTO27I/AAAAAAAACRg/3lPE9BC3q34/s1600/twitter.png'/></a> <a href=' https://www.facebook.com/cityofcorona#!/pages/Mycitycoronacom/72785107519'><img src='http://3.bp.blogspot.com/-eXicwaqYg_g/TeYeNYLBRoI/AAAAAAAACRY/h0ClYvow4dM/s1600/facebook.png'/></a> <a href='http://www.youtube.com/mycitycorona'><img src='http://2.bp.blogspot.com/-JSsslbsKP6c/TeYeNM-dCBI/AAAAAAAACRQ/7fj_kUpd8Gg/s1600/youtube.png'/></a> <a href='http://www.blogger.com/'><img src='http://3.bp.blogspot.com/-GGLOrfudHQk/TeYeM7uThsI/AAAAAAAACRA/dKCw6oMrXfA/s1600/blogger.png'/></a>

<div id='crosscol-wrapper' style='text-align:center'>
<b:section class='crosscol' id='crosscol'>
<b:widget id='PageList1' locked='false' title='Pages' type='PageList'/>
</b:section><div id='searchbox'>
<form action='/search' id='searchthis' method='get'>
<div class='content'>
<input class='textfield' name='q' size='24' type='text' value=''/>
<input class='button' type='submit' value=''/>
<div id='content-wrapper'>

Thank you for assisting...please let me know if I need to provide any additional code.



Msg#: 4325543 posted 4:26 am on Jun 14, 2011 (gmt 0)

add this, for your link <a href="http://facebook.com/" target="_blank">facebook</a>

add the target="_blank" inside the link.


WebmasterWorld Senior Member rocknbil us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 4325543 posted 5:25 pm on Jun 14, 2011 (gmt 0)

Target is invalid in XHTML and that appears to be XHTML. Looking at this code, there may very well be some important XHTML things going on, so a more valid method would be to use Javascript. However, if all that extra code is for something in a CMS and it doesn't validate anyway, use target.

If the code validates, do something like this:

<a id="twitter-link" href="htt p://twitter.com/user-name">

<a id="facebook-link" href="htt p://facebook.com/user-name">

Then between <head> and </head> (or better yet, in one of your JS files,)

<script type="text/javascript">
window.onload=function() { attachBehaviors(); }
function attachBehaviors() {
// Add to this list for more new window links
newwins = ['twitter-link','facebook-link'];
for (j=0;j<newwins.length;j++) {
document.getElementById(newwins[j]).onclick=function() { return newWindow(this.href); };

function newWindow(url) {
var day = new Date();
var id = day.getTime();
var params = 'width=900,height=800,scrollbars,resizable';
var w = open(url,id,params);
return false;

Typed on the fly, may contain errors. You may need to debug it. What this does is applies the JS to the document without clogging it up with code while allowing you to retain a valid link on the new window links.


Msg#: 4325543 posted 9:36 am on Jun 15, 2011 (gmt 0)

As you are not an HTML expert, so just add target="_blank" with within "a" tag.

<a href="www.facebook.com/sandyraman" target="_blank">Join me on FB</a>


5+ Year Member

Msg#: 4325543 posted 5:39 pm on Jun 15, 2011 (gmt 0)

Worked and looks great, thanks.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved