Sunday, January 1, 2012

On-fly windows in Asp.net

If we want to create a window with no source file as it's content then we have to implement on-fly window concept(blank windows)This type of windows content is populated completely based on other programmer statements.The blank windows are not useful but by adding the reference to this blank window we can populate dynamic content .Here i will show how to create the blank window using java script.In java script we use same open method but this time with out file name and assign they open statement result to js variable.

on-fly windows in javacript

<form nane="form1">
username=<input name="t1" />
password=<input name="t2" />
<input name="b1" onclick="fly()" type="button" value="Click me" /> </form>
<script language="javascript">
function fly()
{
x=open("");
x.document.write("<h1>

welcome");
x.document.write("<img src=wondor.gif>");
}
</script>
//Here i will given more example script for area is covered on not.This can be use in above fly() method
x.document.write("welcome"+document.form.t1.value);

 x.document.write("<img src="http://www.blogger.com/wondor.gif" />");
 if(document.form.t2.value="12345")
 {
x.document.write("<img src="http://www.blogger.com/wondor.gif" />");
 x.document.write(" Area covered");
 }
 else
 {
 x.document.write("<img src="http://www.blogger.com/wondor.gif" />");
 x.document.write(" Area not covered");
 }
 }
The above on fly windows code create a blank window and populate static dynamic and decision content.Area not cover is decision base welcome is static username image is dynamic
Note:If you want to display the result in current window just do a small modification as below
this.document.write instead of x.document.write

No comments:

Bel