This code opens a new popup window that contains a timer that counts down, then closes the window when it reaches 0. Will not work if user has a popup blocker blocking the page.
<html>
<head>
<title>Popup Timer</title>
<script language="JavaScript" type="text/JavaScript">
// popup window var
var popup;
// At what number shall the countdown counter start?
CounterStart = 10;
// This function CustomAction() can be modified to do
// whatever you want done every second.
function CustomAction() {
popup.document.timer.timeleft.value = CounterStart;
} // end of function CustomAction()
// end of JavaScript customization
function Decrement() {
CounterStart--;
CustomAction();
if(CounterStart <= 0) { popup.close(); alert('Timer reached 0'); }
else { setTimeout('Decrement()',1000); }
}
function StartTheCounter() {
openPopup(120,100);
setTimeout('Decrement()',1000);
}
f
If you read the jQuery mailing list , you may be aware that I have updated my plugins for working with select boxes . Summary of changes: addOption replaces any options with the same value (so think of it as an add/replace options plugin selectOptions selected options in addition to what was already selected, but there is now an option for it not to do this There are two new methods: copyOptions which is for copying options between select boxes ajaxAddOption allows you to add options via AJAX (i.e. could be used for create options dynamically from a server script)
The 'correct' way to generate Excel spreadsheets is through the use of Office Web Components . However, due to the licensing (see MSKB Article ) you cannot use them on a public internet site (as a client license for Office is needed for each user retrieving the document).
However, this can be overcome due to the fact that Excel recognises HTML code. You can therefore output HTML that can be opened in Excel:
First of all, set the content type and response header to make the browser handle it as an Excel spreadsheet.
ASP VBScript:
<%@Language="VBScript"%>
<%
Response.ContentType="application/vnd.ms-excel"
Response.AddHeader "content-disposition", "attachment; filename=ExcelFileName"
%>
ASP JScript:
<%@Language="JScript"%>
<%
Response.ContentType="application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment; filename=ExcelFileName");
%
Comments