1. Control the reciprocal of the div tag content from the number 10. The reciprocal interval is 1 second.
<script tpe="text/javascript"> var g_var = ; function timerFun() { if (g_var > 0) { document.getElementById("count").innerHTML = g_var--; window.setTimeout(timerFun, 1000); } else { window.close(); } } function init() { window.setTimeout(timerFun, 1000); } </script> <style type="text/css">
2. connect to different pages through input parameters and open different modal windows.
The following is the JavaScript code:
<SCRIPT type = "text/JavaScript"> function opendraw (mode, ID) // input status and award_code {If (mode = 0) {// the URL of award_code Var = "lotterydraw. aspx? Id = "+ ID +" & catch = "+ (new date ()). gettime (); var returnval = Window. showmodaldialog (URL, window, "dialogtop: 0; dialogleft: 0; dialogwidth: 140em; dialogheight: 480em; scrolling: Yes; Status: 0; help: 0 "); if (returnval! = "False") window. Location. Reload ();} else {// award_code var url = "lotteryview. aspx? Id = "+ ID +" & catch = "+ (new date ()). gettime (); window. showmodaldialog (URL, window, "dialogtop: 0; dialogleft: 0; dialogwidth: 640em; dialogheight: 480em; scrolling: Yes; Status: 0; help: 0 ");}} </SCRIPT>
Aspx code:
<Div style = "position: relative; top: 101px; text-align: center; Height: 580px; Background: URL (images/mid_category.gif) No-repeat center; left: -24px; "> <Div class =" menu "> <span> entire employee work zone </span> <asp: repeater id = "rptcommon" runat = "server" onitemdatabound = "rptcommon_itemdatabound">
3. Remove the null characters on both sides of the string to implement the trim function.
// Remove the empty character function trimstr (oobject) {var trimres = nulltrans (oobject); trimres = ltrimstr (trimres); trimres = rtrimstr (trimres ); return trimres;} // determines whether the string is null. If it is null, the function nulltrans (oobject) {var transres = oobject; If (transres = NULL) is returned) {transres = "" ;}return transres;} // remove the left-side empty character function ltrimstr (oobject) {var trimres = nulltrans (oobject); var length = trimres. length; If (length! = 0) {for (I = 0; I <length; I ++) {If (trimres. substr (I, 1 )! = "") {Break ;}} trimres = trimres. substr (I) ;}return trimres;} // remove the empty character function rtrimstr (oobject) {var trimres = nulltrans (oobject); var length = trimres. length; If (length! = 0) {for (I = length-1; I> = 0; I --) {If (trimres. substr (I, 1 )! = "") {Break;} trimres = trimres. substr (0, I + 1);} return trimres ;}