Program:
[html]<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Javadomain Window.open Example</title>
</head>
<body>
<script type="text/javascript">
function site_open(){
var site = document.getElementById("so").value;
window.open(site);
}
function site_open_withoutHTTP(){
var siteH = document.getElementById("soH").value;
window.open(‘http://’+siteH);
}
</script>
<form method="post">
<br>
<br>
Enter the website url to open in the new popup window
<br>
<br>
Eg: http://www.ngdeveloper.com
<br>
<br>
<input type="text" id="so">
<input type="submit" value="Open" onclick="site_open()">
<br>
<br>
Enter the website url
<br><br>
Eg: www.ngdeveloper.com
<br>
<br>
<input type="text" id="soH">
<input type="submit" value="Open" onclick="site_open_withoutHTTP()">
</form>
</body>
</html>[/html]
Output:
Enter the url and click the open button, then entered url will open in the new popup window.
Thanks for reading this post…………..!!!