Passing data from child window to parent window

By , July 24, 2009 8:54 pm

In this blog, i will show you how to pass data from child window to parent window.

1. Create a form in parent window.


<form name="parent"  id="parent">

<input type="text"  id="test" >

<a  onClick=window.open("child.html","TITILE",
"width=850,height=150,status=1,");>open the child window</a>

</form>

2. Create a second window


<form name="child"  id="child">

<input type="text" id="test_2" name="test_2" value="YOUR DATA">

<input type="button"  id="submit"  value="submit" onclick="call_submit();">

</form>

3. Pass data to parent window by javascript


function call_submit()

{

opener.document.parent.test.value=document.child.test_2.value

self.close();

}

Call javascript after page load

By , July 24, 2009 8:00 pm

Recently I required to call a function after a page load in my project.

onLoad event is available in html but not like afterLoad or offLoad event in html.

I found  one of the easiest  solution. Just call a function at end of the page.  :)


<html>

<body>

.....

<script>function_name();</script>

</body>

</html>

Is that so simple?

Panorama Theme by Themocracy