Window: JavaScript window is an object providing number of properties and methods. With window object property , we can access with or without object name.
Alert: It displays the massage box.
Prompt: Displays the input dialog box.
The first argument is the text, what you want to display prompt and the second object is the text on the text box
Sample Script :
window.prompt
<script>
var rval=window.prompt("Enter Course Name" , "PHP")
alert(rval)
</script>
var rval=window.prompt("Enter Course Name" , "PHP")
alert(rval)
</script>
Print: Displays the print property dialog box.
<script>
window.print()
</script>
window.print()
</script>
Confirm: It displays the confirmation dialog box.
<script>
var rv=window.confirm("Do You Want PHP Notes?")
if(rv==true)
print()
else
alert("cancelled")
</script>
var rv=window.confirm("Do You Want PHP Notes?")
if(rv==true)
print()
else
alert("cancelled")
</script>
Location : By using this property we can redirect from one page to another page.
<script>
function fun1()
{
window.location='http://www.danphp.com/'
}
</script>
<input type="button" value="PHP Notes" onclick="fun1()">
function fun1()
{
window.location='http://www.danphp.com/'
}
</script>
<input type="button" value="PHP Notes" onclick="fun1()">
Window.open : By using this property we can open the external web page into new tab.
<script>
function fun1()
{
window.open('http://www.danphp.com/')
}
</script>
<input type="button" value="PHP Notes" onclick="fun1()">
function fun1()
{
window.open('http://www.danphp.com/')
}
</script>
<input type="button" value="PHP Notes" onclick="fun1()">
Window.close: By using this property we can close the open tab.
Window.settimeout: By using this property can call the function on specific time.
<script>
window.setTimeout("fun1()",5000)
function fun1()
{
window.alert("PHP Tutorial")
}
</script>
window.setTimeout("fun1()",5000)
function fun1()
{
window.alert("PHP Tutorial")
}
</script>
Window.setInterval: By using this function we can call another function for every regular interval of times.
ClearInterval : By using this function we can stop the execution of setInterval.
<script>
var si=window.setInterval("fun1()",200)
function fun1()
{
window.alert("Hi PHP Tutorial")
}
function funstop()
{
clearInterval(si)
{
</script>
var si=window.setInterval("fun1()",200)
function fun1()
{
window.alert("Hi PHP Tutorial")
}
function funstop()
{
clearInterval(si)
{
</script>
<input type="button" value="stop" onclick='funstop()'>
Window.CreatePopup : By using this function we can create the pop up dialog box n the webpage.
The below script works in only in Internet Explore, The reason behind this I will post the article tomorrow.
<script>
function create()
{
p=window.createPopup()
pbody=p.document.body;
pbody.innerHTML="Welcome to Danphp a PHP Notes Turorial Website";
pbody.style.color="white";
pbody.style.backgroundColor="green";
pshow(100,50,100,100,document.body)
}
</script>
<input type="button" value="click" onclick="create()">
function create()
{
p=window.createPopup()
pbody=p.document.body;
pbody.innerHTML="Welcome to Danphp a PHP Notes Turorial Website";
pbody.style.color="white";
pbody.style.backgroundColor="green";
pshow(100,50,100,100,document.body)
}
</script>
<input type="button" value="click" onclick="create()">
0 comments:
Post a Comment