For smart Primates & ROBOTS (oh and ALIENS ).

Blogroll

Saturday, October 05, 2013

Open new Windows in jquery and javascript

Open new Windows in jquery and javascript


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="jquery-1.6.3.min.js" type="text/javascript"></script>
</head>
<body>
    <a href="1.html">Click Here</a>
    <a href="2.html">Click Here</a>

<script type="text/javascript">
    $('a').click(function (event) {
        //event.preventDefault();
        var myurl = $(this).attr('href');
        myurl = "http://www.google.com/";
        var left  = ($(window).width()/2)-(900/2);
        //top   = ($(window).height()/2)-(600/2),
        var top   = 800;
        var popup = window.open (myurl, "_blank", "width=900, height=600, top="+top+", left="+left);
        popup.blur();
        self.focus();
        window.open(this.href,'_self');
        window.focus();
    });
</script>
</body>   
</html>
Share:

0 comments:

Post a Comment

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights

Unable to resolve <website url> Try checking the for validity Google Pagespeed Insights   You have a website and want to test it'...

Ads Inside Post

Powered by Blogger.

Arsip

Blog Archive