Wednesday, March 26, 2008

unobtrusive popups-single & multiple

<script type="text/javascript">

function ShowPopup(page)
{
window.open(page,"_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=no, resizable=yes, copyhistory=yes, width=400, height=400");
}

</script>


<a href="../JavaScript/playtime.html" onclick="ShowPopup(this.href); return false;">

SEO-meaningful text here
</a>



=================================
- Multiple popups in a page:
=================================

<script type="text/javascript">

function ShowPopup(page, thisWidth, thisHeight)
{
window.open(page,"_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=no, resizable=yes, copyhistory=yes, width=" + thisWidth + "px, height=" + thisHeight + "px");
}

window.onload=popups;

function popups()
{
var catPics400 = document.getElementById('cats_400');
var catPic = catPics400.getElementsByTagName('a');

for (var i=0; i <
catPic.length; i++)
{
catPic[i].onclick=function()
{
ShowPopup(this.href, '400', '400');
return false;
}
}
var catPics600 = document.getElementById('cats_600');
var catPic = catPics600.getElementsByTagName('a');

for (var i=0; i <
catPic.length; i++)
{
catPic[i].onclick=function()
{
ShowPopup(this.href, '600', '600');
return false;
}
}
}

</script>

In page:
<ul id="cats_400">
<li>
<a href="page.html">
SEO-meaningful text here
</a>
</li>
<li>

<a href="page.html">
SEO-meaningful text here
</a>
</li>
<li>
<a href="page.html">
SEO-meaningful text here
</a>
</li>
</ul>
<ul id="cats_600">
<li>
<a href="page.html">
SEO-meaningful text here
</a>
</li>
<li>
<a href="page.html">

SEO-meaningful text here
</a>
</li>
<li>
<a href="page.html">
SEO-meaningful text here
</a>
</li>
</ul>

No comments: