Open Bigger Picture

[Total: 0    Average: 0/5]

This examples shows how to have images that can be clicked on to open up a new window that has a bigger picture (or just different).

Head Code:

<script type=text/javascript>
// this code will receive an error if the user
// clicks the "X" to close the pop up....
// otherwise it knows not to open it again, or
// that it needs to open it...
var _winObj;
function openIt(urlLoc) {
  if (_winObj || _winObj != null) { return; }
  _winName = "BigPicWindow";
  _info = "toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=auto,resizable=yes,dependent,height=300,width=420,left=0,top=0";
  _winObj=window.open(urlLoc,_winName,_info);
} 
</script>

Body Code:

<script>
var bigPic = new Array();
    bigPic[1] = "http://www.js-examples.com/js/pic3.gif";
    bigPic[2] = "http://www.js-examples.com/js/pic4.gif";
function showBig(_n) {
  openIt(bigPic[_n]);
}
</script>
<a href="javascript:showBig(1)"><img src="http://www.js-examples.com/js/pic1.gif"></a>
<br>
<a href="javascript:showBig(2)"><img src="http://www.js-examples.com/js/pic2.gif"></a>
<br>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *