In my Program have one hiperlink ..
when we click hiperlink a small popup will open and ask name and this name sending using form.
So how to create popup using jsp or javascript or jquery?
This question is related to
javascript
jquery
jsp
You can use window.open for this
window.open("page url",null,
"height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
have a look at this link.. window.open
Try this:
SCRIPT:
function winOpen()
{
window.open("yourpage.jsp");
}
HTML:
<a href="javascript:;" onclick="winOpen()">Pop Up</a>
Read https://developer.mozilla.org/en/docs/DOM/window.open for window.open
The following JavaScript will open a new browser window, 450px wide by 300px high with scrollbars:
window.open("http://myurl", "_blank", "scrollbars=1,resizable=1,height=300,width=450");
You can add this to a link like so:
<a href='#' onclick='javascript:window.open("http://myurl", "_blank", "scrollbars=1,resizable=1,height=300,width=450");' title='Pop Up'>Pop Up</a>
<a href="javaScript:{openPopUp();}"></a>
<form action="actionName">
<div id="divId" style="display:none;">
UsreName:<input type="text" name="userName"/>
</div>
</form>
function openPopUp()
{
$('#divId').css('display','block');
$('#divId').dialog();
}
Can be done with in jquery-
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#dialog" ).dialog();
});
</script>
<div id="dialog" title="Basic dialog">
//your form layout
</div>
Source: Stackoverflow.com