C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




window.close() in javascript


Posted Date: 01 Aug 2008      Total Responses: 3

Posted By: lakshmi pathipati       Member Level: Silver     Points: 1


Thanks for ur responce.

But when iam calling window.close(),a dialog box coming autometically.so how to catch that Yes & No events.

Or else how to hide that autometically coming dialog box,when calling window.close().

Thanks in advance




Responses

Author: Deepa    01 Aug 2008Member Level: DiamondRating:     Points: 1
<html>
<head>
<title>JavaScript Window Close Example </title>
</head>
<SCRIPT language="JavaScript1.2">
function popuponclick()
{
my_window = window.open("",
"mywindow","status=1,width=350,height=150");
my_window.document.write('<H1>The Popup Window</H1>');
}

function closepopup()
{
if(false == my_window.closed)
{
my_window.close ();
}
else
{
alert('Window already closed!');
}
}
</SCRIPT>
<body>
<P>
<A href="javascript: popuponclick()">Open Popup Window</A>
</P>
<P>
<A href="javascript: closepopup()">Close the Popup Window</A>
</P>
</body>
</html>



Author: Sree Raj    01 Aug 2008Member Level: GoldRating:     Points: 5
hi try this code\


Hi,
try the below code

string strCode;

strCode = " <script language='javascript' type=text/javascript>"
var hdn1 = document.getElementsByName(hdnField');

var savresult=confirm('Do You want to delete all documents and its versions?');
if(savresult==1)

{
//write ur code
}

else
{


//write Your Code
}
</script>

ClientScript.RegisterClientScriptBlock(this.GetType(), "onclick()", strCode.ToString(),false);

Regards
SreeRaj




Author: G.Hemadribabu    01 Aug 2008Member Level: GoldRating:     Points: 5
When you clik a button, it has to ask you 2 question
Are you sure you want to exit
1.yes
2. No
If you press yes the window gets closed automatically
If you select No , then the window remains constantly,

For this,You have to write a small javascript in the buttonclick event like this

The coding shoudl bein response.write()

The command is


Response.Write("<script language='javascript'> { self.close() }</script>")


Hope Thsi will match your requirements perfectly.





Post Reply
You must Sign In to post a response.
Next : Printing a page through javascript
Previous : I need code to validate email,phone number,string
Return to Discussion Forum
Post New Message
Category: JavaScript

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

it support

Contact Us    Privacy Policy    Terms Of Use