|
MSDN:
"When a string is assigned to the returnValue property of window.event, a dialog box appears that gives users the option to stay on the current page and retain the string that was assigned to it. The default statement that appears in the dialog box, "Are you sure you want to navigate away from this page? ... Press OK to continue, or Cancel to stay on the current page.", cannot be removed or altered."
Example from MSDN:
<HTML>
<HEAD>
<SCRIPT>
function closeIt()
{
event.returnValue = "Any string value here forces a dialog box to \
appear before closing the window.";
}
</SCRIPT>
</HEAD>
<BODY onbeforeunload="closeIt()">
<a href="http://www.microsoft.com">Click here to navigate to
www.microsoft.com</a>
</BODY>
</HTML>
---
b { font-weight: normal; }
|
|
|
|
|
Sorry, I'm the author of this question but I lost my account.
Can I close that window automatically when it appear ? or do you know how to do like that window ?
|
|
|
|
|
If any browser allows such a thing, then take it as a bug. The idea behind it is that users get one chance (and only one!) to re-think their decision to close a window, thus giving web developers an opportunity to remind users of unsaved form data, etc. If you could actually stop the user from closing / leaving a page, then it would invite usability problems, to say the least.
|
|
|
|
|
I have the code:
<table><tr>
<td id="text"><a href="abc.htm">hung1</a></td>
</tr>
</table>
I want when I click on this text "abc page" the message box appear and if user choose "cancel" then nothing change (like Message box above of IE).
I used this javascript code:
<SCRIPT FOR=text EVENT=onclick>
confirm("Save?");
</SCRIPT>
But not successful. What must I do?
|
|
|
|
|
the js code should be something like this:
onclick="return confirm('Save?')
<< >>
-- modified at 0:59 Saturday 10th September, 2005
|
|
|
|
|
hello,
i need to retrieve the value of a hidden html field in a JSTL expression.
I've tried a lot of solution but none worked.
Tried with value ="${param.fieldname}", <c:set ...
servlet pageContext.set attribute....
In partiicular i have a text field witch contains a string like"yyMMdd...."
and i need to fmt:parseDate and fmt:formatDate it but i cannot get it's value and it cames empty.
What is the solution?
Please help as soon as possible. Thanks a lot
Domenico
|
|
|
|
|
Back ground to a problem:
---------------------------
We have a page of multiple choice questions in a Test (ASP application) that has a timer. Since there are several questions on the page obviously the page scrolls, and to enable the student to see the time remaining as per timer, we have made a separate frame and fixed the timer in that- on the top right.
If the questions are not completed by the student, and the time is up- this questions page auto submits.
The Problem:
----------------
When the student clicks on submit button indicating that he has finished with the questions, or if the page auto submits…the student moves to the answers page, but the timer appears here also.
Can someone please suggest a way by which the timer is restricted to the Questions page only- at the top right in a fixed manner?
|
|
|
|
|
Put target="_top" in the form.
---
b { font-weight: normal; }
|
|
|
|
|
hi guys, i have a jscript piece of code that is not displaying the records together with the radio buttons, The sql statement works fine (i checked it in Access and it works) but it just won't display, can someone check where i went wrong please. There are no errors, it just displays the 'update" button.
here it is
<html>
<head>
<title>Attendance Records</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 10pt;
}
-->
</style>
</head>
<body>
<%@ LANGUAGE="JAVASCRIPT" %>
<%
var conn;
var rs;
var strSQL;
var fld;
conn = new ActiveXObject("ADODB.Connection");
conn.Open("Provider=Microsoft.Jet.OLEDB.4.0; DATA SOURCE = " + Server.MapPath("db1.mdb"));
if(Request.Form("update") == "update"){
for (var fld in Request.Form)
{
if(Left(fld,7) == "status_"){
student_id = CLng(Mid(fld,8));
attendance = Request.Form(fld);
strSQL = "Update tblattendatt_status = '" + attendance + "' WHERE studentID = " + student_id + " && att_date = Date()";
conn.Execute (strSQL);
if(recsupdated == 0){
conn.Execute = "Insert INTO tblattend(studentID,att_status,att_date) VALUES(" + student_id + ",'" + attendance + "', #" + Month(Date()) + "/" + Day(Date()) + "/" + Year(Date()) + "#)";
}
}
next;
}
rs = conn.Execute("Select tblstudent.studentID, tblstudent.Name, tblattend.att_status From tblstudent LEFT JOIN tblattend ON (tblstudent.studentID = tblattend.studentID && tblattend.att_date = Date()) ORDER by tblstudent.Name");
function currentstatus(statval){
if(rs("att_status") == statval){
currentstatus = " checked";
}else{
currentstatus = "";
}
}
%>;
<div align="center"><font size="3">Attendance records for today</font></div>;
<form name="form1" method="post" action="">;
<table width="50%" border="0" align="center" cellpadding="4" cellspacing="0">;
<tr bgcolor="#CCCCCC">;
<td width="58%">Student</td>;
<td width="14%">Present</td>;
<td width="14%">Absent</td>;
<td width="14%">Late</td>;
</tr>;
<%
while (!rs.eof) {
Response.Write("<tr>");
Response.Write("<td>" + rs("Name") + "</td>");
Response.Write("<td><input type=radio name='status_" + rs("studentID") + "' value='P" + currentstatus("P") + "'></td>");
Response.Write("<td><input type=radio name='status_" + rs("studentID") + "' value='A" + currentstatus("A") + "'></td>");
Response.Write("<td><input type=radio name='status_" + rs("studentID") + "' value='L" + currentstatus("L") + "'></td>");
Response.Write("</tr>");
rs.movenext();
Wend();
}
rs.Close();
conn = null;
}
%>
<tr bgcolor="#CCCCCC"><td></td><td></td><td></td><td><input type="submit" name="update" value="update"></td></tr>
</table>
</form>
</body>
</html>
|
|
|
|
|
Hi all, I have a query regarding javascript regular expression.
I have one string which has "(double quote) and \(slash) characters.
Now, how I can replace these ( " with \" and \ with \\)using regular expressions at one iteration otherwise it will be recursive.
I mean we have to check every character and replace it. Can I use replace() method for this?
Thanks,
Jay
|
|
|
|
|
You don't have to use regular expressions for that.
oneString = oneString.replace('\\', '\\\\').replace('"', '\\"');
---
b { font-weight: normal; }
|
|
|
|
|
How do I get the maxlength attribute of an input field in a java-script
eg
document.getElementById("keypad1_txtResult").value
gives me the value
but document.getElementById("keypad1_txtResult").maxlength
gives me undefined
clueless
|
|
|
|
|
maxLength
Javascript is case sensetive.
---
b { font-weight: normal; }
|
|
|
|
|
Does any know how to not display the browser toolbar in a web page?
Clueless
|
|
|
|
|
hi there,
this can be done with js: window.open with feature "toolbar=no"
the link below might give u more infor on this
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/open_0.asp
<< >>
-- modified at 8:16 Thursday 8th September, 2005
|
|
|
|
|
Thanks, but I still don't follow. I want the first page displayed not to display the toolbar.
|
|
|
|
|
The appearance of the first page is the user's decision. They may want the toolbar. You can have some control over auxilary windows (as the previous poster mentioned), but the main window is the user's.
|
|
|
|
|
I am designing a webpage and I want to write some script(javascript) to show a confirm message "Do you want to exit?" when I close this page (or switch to another page). If I click "Ok" the page will close (or switch to another page) and if I click "cancel" the page will not close. What must I do?.
|
|
|
|
|
|
Thank for your help . But it's not what I want. Look at my code below:
function closeIt()
{
event.returnValue = "Do you want to exit?";
}
Click here to navigate to
www.microsoft.com
When I click to navigate to another page, I want to show a confirm "Do you want to exit?". If I click Ok, I can navigate to another page. If I click cancel, nothing happen. That's what I want. But when I close the page, a confirm "Are you sure you want to navigate away from this page? Do you want to exit? Press Ok to continue, or Cancel to stay on the current page." appear, that's too long and complicated. I just want to show a confirm "Do you want to exit?".
Undead142
-- modified at 22:49 Thursday 8th September, 2005
|
|
|
|
|
Basically, when you navigate to another page or close the browser the onbeforeunload , and onunload events get fired. You can raise the confirm message with the onunload event, but it's too late to cancel the event. So the only thing IMO you can use is the onbeforeunload . Thought it not 100% what you want, it seems quite close to that.
|
|
|
|
|
I want to call the Escape Key immediately after the page unload. But I don't know how to call the Escape Key ? Please help me !
Hung
|
|
|
|
|
I am in a slight dilemma at the moment i'm not sure whether to go down the a+/mcse route or whether to take the CIW courses instead. I have been doing some research to try and find out about them I would appreciate any opinions you have on the CIW and MCDBA.
I have quite good html skills and know some Javascript when it comes to web design. Wouldn’t mind taking things a step further by taking the CIW course but I need to know if employers recognize it and does passing the CIW give you a reasonable chance of getting a job in web design or anything related to the Internet?
Alisia
|
|
|
|
|
What is CIW ?
AlisiaWillimans wrote:
I have quite good html skills and know some Javascript when it comes to web design.
Sorry, but these were marketable in about 1998.
AlisiaWillimans wrote:
Wouldn’t mind taking things a step further by taking the CIW course but I need to know if employers recognize it and does passing the CIW give you a reasonable chance of getting a job in web design or anything related to the Internet?
To write web sites nowadays, you should learn J2EE or ASP.NET. ASP.NET is definately nicer and easier. Then you'd have marketable skills, for sure. I have no idea what employers regard as highly, except that I am sure they will regard it highly if you show up having taught yourself, and show yourself to be knowledgable. That's how I got my job, I have no qualifications at all.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I am wondering what is the best way to validate username text on a page. HTMLEncoding and URLEncoding are what I have found to validate the username. Is there a better way to check for script attacks then this or am I on the right track?
|
|
|
|