• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Tuesday, July 10, 2012

TUTORIAL JAVASCRIPT - WINDOW OBJECT FOR NEWBIE


A. Opening Window In Javascript

For open window in javascript we can using method “open()”

Sintaks:
Window.open(url, name_window, configuration)

Example:
Window.open(“http://www.have-fun-and-enjoy.blogspot.com”, MyWindow”, width=”200”, height=”200”);

In window to be found 6 configuration :
1. Width
2. height
3. toolbar
4. menubar
5. scrollbar
6. resizable

For configuration we can setting, and this of define :

Configurations
Define
Value
Width
Setting Width of window
You can using “px”
Height
Setting Height of window
You can using “px”
Toolbar
For to appear browser toolbar
1 or 0
Menubar
For to appear browser menubar
1 or 0
Scrollbar
For to appear browser scroolbar
1 or 0
Resizeable
For change size window with direct
1 or 0


Example:

You can copy this code and paste in your application

<html>
<head>We Are Knowledge<br><br>
<title>Tutorial Window In javascript</title>
</head>
<body>
<script>
function open_WAK()
{
window.open("http:www.have-fun-and-enjoy.blogspot.com", "We Are Knowledge", height = "300", width = "400", toolbar = "1");
}
</script>
<input type = "button" onclick="open_WAK()" value="GO">
</body>
</html>

If done, you must save with “save as type = html”.
And for working program you just “double click of file”.


B. Reloading, Closing, Loading New Page, And Print.

For reloading window this method :
Window.location.reload()

And for closing window is with method:
Window.close:

For Loading New Page:

Or you can edit and this method:
<a href=” Window.location=www.have-fun-and-enjoy.blogspot.com”>W-A-K</a>

For printing web page:
Window.print()


C. Comunication Between Window

Define of communication between window is change, comunicastion, and manipulation object in window perent moment we open new window.

Sintaks window perent:
Window.opener

Example:
In this example you must made two file.. Is..
1. main file, for showing frist page, it want present for go to second file
2. second file, is part of main file.

A. Main file

<html>
<head>We Are Knowledge<br><br>
<title>Tutorial Window In javascript</title>
</head>
<script language="text/javascript">
function open_WAK()
{
var a = window.open("second", "newwindow", height = "300", width = "400");
}
</script>
</head>
<body>
<form name = x>
<input type= "button" value = "open" name="submit" onClick="open_WAK();">
<input type = "text" name="try" id="f">
</body>
</html>


B. Second File

<html>
<title><titlle>
<script language="text/javascript">
function h()
{
window.opener.document.getElementByid("f"). value = document.getElementByid("input"). value;
}
</script>
</head>
<body>
<form name= myform>
<input type="text" name="input" id ="input">
<input type="button" value="GO" onClick="h();">
</form>
</body>
</html>


Ok just for it… If you like this don’t forget bookmark this page..

And if you will question, please leaving comment.. And please wait. I want answer it.

Thanks visitor….

No comments:

Post a Comment