admin管理员组

文章数量:1278919

In my asp page, i want to show a popup window whenever user clicks the button.The popup window contains one text box and submit button for getting the filepath from the user.

for example : i want a popup like this in stackoverflow site...

Please hele me to get this...

In my asp page, i want to show a popup window whenever user clicks the button.The popup window contains one text box and submit button for getting the filepath from the user.

for example : i want a popup like this in stackoverflow site...

Please hele me to get this...

Share Improve this question asked Jun 8, 2012 at 7:24 SaravananSaravanan 11.6k46 gold badges147 silver badges213 bronze badges 1
  • 1 The "popup window" is just a div with an absolute position. Look at modal windows on google. – Florian Margaine Commented Jun 8, 2012 at 7:31
Add a ment  | 

2 Answers 2

Reset to default 4

Here is a EDITED:demo.Customize it to suit your needs.Let me know if need further help. I have added a link which will display the popup on click. After that the popup div is the actual popup , the popup div contains another div , just to hold the contents , in this case textbox and buttons.Here is the Html part.

<a id="popuplink" href="#">Click Me</a>
<div id="popup">
<div id="content">
<input type="text"/><input type="Button" value="Browse..."/>
    <input id="popupclose" type="Button" value="Close"/>   
 </div>   

</div>​

Here is CSS:

#popup
{
    display:none;
    position:fixed;
    width:250px;
    height: 150px;
    top: 50%;
    left: 50%;
    margin-left:-155px;
    margin-top:-110px;
    border:5px solid red;
    background-color:#DEDFDE;
    padding:30px;
    z-index:102;
    font-family:Verdana;
    font-size:10pt;
    border-radius:10px;
    -webkit-border-radius:20px;
    -moz-border-radius:20px;
    font-weight:bold;
}
#content
{
    height:auto;
    width:250px;
    margin:60px auto;
}
#popupclose
{
    margin:35px 0 0 80px;
    width:50px;

}​

EDIT: To get the value of the textbox check This demo

To call the javascript function on click of Asp.Net Button , try doing something like this. Create a function which will show the popup.

function ShowPopUp()
{
  $('#popup').show("slow");
}

And on button click try this,

ClientScript.RegisterStartupScript(GetType(), "popup", "ShowPopUp()", true);

Additional Information MSDN

If I understand you correctly you want to use window.open, here's some info: https://developer.mozilla/en/DOM/window.open

Do you need something like this (this is a crude example as I don"t know the name of your page, etc, etc...):

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function open_win() {
window.open("mypage.html");
}
</script>
</head>    
<body>
<form>
<input type="button" value="Open Window" onclick="open_win()">
</form>
</body>

</html>

However I'd advise doing this in an unobtrusive manner.

本文标签: htmlHow to show a popup with textbox and browse button in javascriptStack Overflow