Wednesday, 30 March 2011

How we can open Popup Window using asp.net


Introduction
Though this article I will discuss how we can open popup window using anchor tag  in .aspx page.

HTML CODE

Paste this javascript function inside the <head> tag of .aspx page.
<head runat="server">
    <title></title>
<script type="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
// You can set the height width scrollbar & menubar according to your
// requirement
window.open(href, windowname, 'width=700,height=400,scrollbars=yes');
return false;
}
//-->
</SCRIPT>

</head>

Now see the body section of the .aspx page. I am calling the javascript function, which we have been created inside the head tag named popup()inside the <a>anchor tag.  For this see below


<body>
<form id="form1" runat="server">
    <div>
   <a  href ="http://useofaspdotnet.blogspot.com/"  onclick="return popup(this,'examplea')">this link</a>


    </div>
    </form>
</body>

See output below in popup window





4 comments:

  1. Replies
    1. Hi!! jay suresh kumawat Thankx you sir. Please feel free to get in touch with my blog and you can also give us your expensive suggestions to improve this blog.

      Delete
  2. Learn digital ,marketing masters course for free online stop wasting your time in searching . Click the links below to register limited seats are left
    Digital Marketing Agency Mumbai
    Digital Marketing Agency In Noida
    Digital Agency Noida
    Digital Marketing Agency In Chennai
    Digital Marketing Services in Delhi

    ReplyDelete