锘??xml version="1.0" encoding="utf-8" standalone="yes"?> 姣斿gender涓?鏄劇ず鐢鳳紝鍏朵綑鏄劇ず濂籌紝鎴戜滑鍙互榪欎箞鍐欙細(xì) 浣嗘槸涓嶆槸鏄懼緱澶夯鐑︿簡錛熷叾瀹炴垜浠繖閲屽氨鍙互浣跨敤EL琛ㄨ揪寮忎腑鐨勪笁鍏冭繍綆楃浜嗭紝涓婇潰鍙互綆鍖栦負(fù)錛?/p>
${gender eq 0?"鐢?:"濂?} 榪欐牱鏄笉鏄畝緇冧簡寰堝錛熷湪JSTL鍜孍L澶勭悊闈濧鍗矪鐨勬椂鍊欙紝涓夊厓榪愮畻絎︾畝鍗曚簡璁稿銆?/p>
杞澆璇鋒敞鏄庯細(xì)瑙傛祴鑰?/a> » JSP涓璄L琛ㄨ揪寮忎笁鍏冭繍綆楃鐨勪嬌鐢?/a> function openAndClose(myelement) { }
]]>
<c:when test="${gender eq 0}">鐢?span style="color: rgb(0,0,128); font-weight: bold"></c:when>
<c:otherwise>濂?span style="color: rgb(0,0,128); font-weight: bold"></c:otherwise>
</c:choose>
]]>
]]>
alert(myelement.attributes["value"].value );
]]>
http://www.miniui.com/demo/#src=messagebox.html
]]>
var t = document.getElementById("myT");
for ( var i = 0; i < 3; i++) {
var r = t.insertRow();
for ( var j = 0; j < 2; j++) {
var c = r.insertCell();
if (j == 0) {
c.innerHTML = "濮撳悕錛?+i+","+j;
} else {
c.innerHTML = "<input type='text' name='n' />";
}
}
}
t.setAttribute('border', '1');
}
function deleteTable() {
var objTable = document.getElementById("myT");
objTable.setAttribute('border', '0');
for ( var i = 0; i <= objTable.rows.length+1; i++) {
objTable.deleteRow(0);
}
}
//閫氳繃緇忕含搴﹀潗鏍囨潵鍒濆鍖栧湴鍥?br />var point = new BMap.Point(125.4360909,43.78802888999); // 鍒涘緩鐐瑰潗鏍?nbsp;
map.centerAndZoom(point, 15); // 鍒濆鍖栧湴鍥撅紝璁劇疆涓績鐐瑰潗鏍囧拰鍦板浘綰у埆
//閫氳繃鍩庡競鍚嶇О鏉ュ垵濮嬪寲鍦板浘
//map.centerAndZoom("闀挎槬");
var marker = new BMap.Marker(point); // 鍒涘緩鏍囨敞
map.addOverlay(marker);
map.enableScrollWheelZoom(); // 寮鍚紶鏍囨粴杞緝鏀?nbsp;
map.enableKeyboard(); // 寮鍚敭鐩樻帶鍒?nbsp;
map.enableContinuousZoom(); // 寮鍚繛緇緝鏀炬晥鏋?nbsp;
map.enableInertialDragging(); // 寮鍚儻鎬ф嫋鎷芥晥鏋?
map.addControl(new BMap.NavigationControl()); //娣誨姞鏍囧噯鍦板浘鎺т歡(宸︿笂瑙掔殑鏀懼ぇ緙╁皬宸﹀彸鎷栨嫿鎺т歡)
map.addControl(new BMap.ScaleControl()); //娣誨姞姣斾緥灝烘帶浠?宸︿笅瑙掓樉紺虹殑姣斾緥灝烘帶浠?
map.addControl(new BMap.OverviewMapControl()); // 緙╃暐鍥炬帶浠?br />map.addControl(new BMap.MapTypeControl()); //// 浠呭綋璁劇疆鍩庡競淇℃伅鏃訛紝MapTypeControl鐨勫垏鎹㈠姛鑳芥墠鑳藉彲鐢╩ap.setCurrentCity("鍖椾含");
map.setCurrentCity("鍚夋灄鐪?);
//娣誨姞鑷畾涔夋帶浠?/p>
// 瀹氫箟涓涓帶浠剁被錛屽嵆function
function ZoomControl(){
// 璁劇疆榛樿鍋滈潬浣嶇疆鍜屽亸縐婚噺
this.defaultAnchor = BMAP_ANCHOR_TOP_LEFT;
this.defaultOffset = new BMap.Size(50, 10);
}
// 閫氳繃JavaScript鐨刾rototype灞炴х戶鎵夸簬BMap.Control
ZoomControl.prototype = new BMap.Control();
// 鑷畾涔夋帶浠跺繀欏誨疄鐜癷nitialize鏂規(guī)硶錛屽茍涓斿皢鎺т歡鐨凞OM鍏冪礌榪斿洖
// 鍦ㄦ湰鏂規(guī)硶涓垱寤轟釜div鍏冪礌浣滀負(fù)鎺т歡鐨勫鍣紝騫跺皢鍏舵坊鍔犲埌鍦板浘瀹瑰櫒涓?nbsp;
ZoomControl.prototype.initialize = function(map){
// 鍒涘緩涓涓狣OM鍏冪礌
var div = document.createElement("div");
// 娣誨姞鏂囧瓧璇存槑
div.appendChild(document.createTextNode("闀挎槬宸ヤ笟澶у浜烘枃淇℃伅瀛﹂櫌"));
// 璁劇疆鏍峰紡
div.style.cursor = "pointer";
div.style.border = "1px solid gray";
div.style.backgroundColor = "white";
// 緇戝畾浜嬩歡錛岀偣鍑諱竴嬈℃斁澶т袱綰?nbsp;
div.onclick = function(e){
alert("闀挎槬宸ヤ笟澶у浜烘枃淇℃伅瀛﹂櫌");
}
// 娣誨姞DOM鍏冪礌鍒板湴鍥句腑
map.getContainer().appendChild(div);
// 灝咲OM鍏冪礌榪斿洖
return div;
}
// 鍒涘緩鎺т歡瀹炰緥
var myZoomCtrl = new ZoomControl();
// 娣誨姞鍒板湴鍥懼綋涓?nbsp;
map.addControl(myZoomCtrl);
//娣誨姞淇℃伅紿楀彛
var opts = {
width : 200, // 淇℃伅紿楀彛瀹藉害
height: 70, // 淇℃伅紿楀彛楂樺害
title : "闀挎槬宸ヤ笟澶у浜烘枃淇℃伅瀛﹂櫌" // 淇℃伅紿楀彛鏍囬
}
var infoWindow = new BMap.InfoWindow("鎮(zhèn)ㄥソ錛屾榪庢潵鍒伴暱鏄ュ伐涓氬ぇ瀛︿漢鏂囦俊鎭闄?, opts); // 鍒涘緩淇℃伅紿楀彛瀵硅薄
map.openInfoWindow(infoWindow, map.getCenter()); // 鎵撳紑淇℃伅紿楀彛
</script>
</body>
</html>
榪愯鏁堟灉鍥?br />
transitional.dtd">
<html xmlns="<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>JavaScript榪囨渤娓告垙</title>
<style type="text/css">
#content{width:800px;height:600px;border:1px #333333 solid;overflow:hidden;}
#A{width:120px;height:600px;float:left;background:#996633;}
#B{width:560px;height:600px;float:left;background:#0099FF;}
#river{width:560px;height:450px;}
#operator{width:560px;height:150px;background:#99CCFF;overflow:hidden;}
#C{width:120px;height:600px;float:right;background:#996633;}
#people{width:100px;height:20px;border:2px #000000 solid;margin:10px auto;text-
align:center;cursor:pointer;padding:10px 0px;}
#ship{width:200px;height:20px;border:1px #CC3300
solid;background:#663300;position:relative;top:150px;left:0px;text-align:center;padding:10px 0px;cursor:pointer;}
#btns{width:560px;height:40px;margin-top:10px;}
#btn{width:60px;height:20px;border:1px #000000 solid;background:#FFFFCC;text-align:center;padding:10px
0px;cursor:pointer;float:left;margin-left:210px;display:inline;}
#new{width:60px;height:20px;border:1px #000000 solid;background:#FFFFCC;text-align:center;padding:10px
0px;cursor:pointer;float:left;margin-left:10px;display:inline;}
#rule{width:560px;height:100px;margin-top:10px;font-family:瀹嬩綋;font-size:12px;color:#666666;line-
height:16px;text-align:center;}
</style>
<script type="text/javascript">
var direction; //A to C:true ; C to A:false
var people=new Array(9);
var s2Able; //鍒ゆ柇鑸?鏄惁鏈変漢
var s1Able; //鍒ゆ柇鑸?鏄惁鏈変漢
var pInShip1; //鍝釜浜哄湪鑸?涓?br />var pInShip2; //鍝釜浜哄湪鑸?涓?br />function init(){
var peopleA=document.getElementById("A").getElementsByTagName("div");
var ships=document.getElementsByName("ship");
var peopleC=document.getElementById("C").getElementsByTagName("div");
var moveBtn=document.getElementById("btn");
var newBtn=document.getElementById("new");
for(var i=0,len=peopleC.length;i<len;i++){
peopleC[i].style.visibility="hidden";
}
s1Able=true;
s2Able=true;
direction=true;
for (var i=0;i<9;i++)
{
people[i]=true;
}
//娉ㄥ唽浜嬩歡
var len=peopleA.length;
for(var j=0;j<len;j++){
(function(m){
peopleA[m].onclick = function(){
if(direction)
selectPeople(this,m+1);
};
peopleC[m].onclick = function(){
if(!direction)
selectPeople(this,m+10+1);
};
})(j);
}
ships[0].onclick=function(){
quitShip(this,pInShip1);
s1Able=true;
pInShip1=0;
};
ships[1].onclick=function(){
quitShip(this,pInShip2);
s2Able=true;
pInShip2=0;
};
moveBtn.onclick=function(){
move();
};
newBtn.onclick=function(){
window.location = window.location;
};
}
function selectPeople(obj,move_num){
var ships=document.getElementsByName("ship");
if(s1Able){
ships[0].innerHTML=obj.innerHTML;
obj.style.visibility="hidden";
s1Able=false;
pInShip1=move_num;
if(move_num>10)
people[move_num-10]=!people[move_num-10];
else
people[move_num]=!people[move_num];
}
else if(s2Able){
ships[1].innerHTML=obj.innerHTML;
obj.style.visibility="hidden";
s2Able=false;
pInShip2=move_num;
if(move_num>10)
people[move_num-10]=!people[move_num-10];
else
people[move_num]=!people[move_num];
}
// 鐑堢伀綞?liehuo.net 嬈㈣繋澶嶅埗,鎷掔粷鎭舵剰閲囬泦 锝岋綁锝咃綀锝曪綇錛庯綆锝咃綌
else{
alert("鑸逛笂鏈澶氫袱涓漢錛屽凡婊?");
}
}
function quitShip(obj,quitId){
if(obj.innerHTML != ""){
var peopleA=document.getElementById("A").getElementsByTagName("div");
var peopleC=document.getElementById("C").getElementsByTagName("div");
if(quitId > 10){
peopleC[quitId-10-1].style.visibility="visible";
people[quitId-10]=!people[quitId-10];
}
else{
peopleA[quitId-1].style.visibility="visible";
people[quitId]=!people[quitId];
}
obj.innerHTML="";
}
}
function motherCheck(){
if(people[1]==people[5])
{
if(people[4]!=people[1])
{
alert("濡堝鎵撳効瀛?");
return false;
}
}
if(people[1]==people[6])
{
if(people[4]!=people[1])
{
alert("濡堝鎵撳効瀛?");
return false;
}
}
return true;
}
function fatherCheck(){
if(people[4]==people[2])
{
if(people[1]!=people[4])
{
alert("鐖哥埜鎵撳コ鍎?");
return false;
}
}
if(people[4]==people[3])
{
if(people[1]!=people[4])
{
alert("鐖哥埜鎵撳コ鍎?");
return false;
}
}
return true;
}
function policeCheck(){
if(people[7]!=people[8])
{
for(var i=1;i<8;i++)
{
if(people[8]==people[i])
{
alert("鐘漢浼や漢");
return false;
}
}
}
return true;
}
function atoc(peopleId){
var peopleC=document.getElementById("C").getElementsByTagName("div");
var ships=document.getElementsByName("ship");
var tempId;
if(peopleId > 10){
tempId = peopleId - 10 -1;
}
else
tempId = peopleId - 1;
if(tempId >= 0)
peopleC[tempId].style.visibility="visible";
for(var i=0,len=ships.length;i<len;i++){
ships[i].style.left = "360px";
ships[i].innerHTML = "";
}
}
function ctoa(peopleId){
var peopleA=document.getElementById("A").getElementsByTagName("div");
var ships=document.getElementsByName("ship");
var tempId;
if(peopleId > 10){
tempId = peopleId - 10 -1;
}
else
tempId = peopleId - 1;
if(tempId >= 0)
peopleA[tempId].style.visibility="visible";
for(var i=0,len=ships.length;i<len;i++){
ships[i].style.left = "0px";
ships[i].innerHTML = "";
}
}
function move(){
if(pInShip1==1 || pInShip1==4 || pInShip1==7 ||
pInShip1==11 || pInShip1==14 || pInShip1==17 ||
pInShip2==1 || pInShip2==4 || pInShip2==7 ||
pInShip2==11 || pInShip2==14 || pInShip2==17
) //寮鍔ㄨ埞鍙殑浜哄彧鑳芥槸鐖哥埜濡堝鎴栬呮槸璀﹀療
{
if (motherCheck()&& fatherCheck() && policeCheck())
{
if(direction)
{
atoc(pInShip1);
atoc(pInShip2);
direction=false;
}
else
{
ctoa(pInShip1);
ctoa(pInShip2);
direction=true;
}
s1Able=s2Able=true;
pInShip1=pInShip2=0;
var peopleC=document.getElementById("C").getElementsByTagName("div");
var result = true;
for(var i=0,len=peopleC.length;i<len;i++){
if(peopleC[i].style.visibility=="hidden"){
result = false;
break;
}
}
if(result){
alert("浣犵湡鍘夊錛?);
window.location = window.location;
}
}
}
else
alert("鍙湁濡堝銆佺埜鐖稿拰璀﹀療鑳芥拺鑸癸紒");
}
window.onload = function(){
init();
};
</script>
</head>
<body>
<div id="content">
<div id="A">
<div id="people" name="people">濡堝</div>
<div id="people" name="people">濂沖効1</div>
<div id="people" name="people">濂沖効2</div>
<div id="people" name="people">鐖哥埜</div>
<div id="people" name="people">鍎垮瓙1</div>
<div id="people" name="people">鍎垮瓙2</div>
<div id="people" name="people">璀﹀療</div>
<div id="people" name="people">鍦熷尓</div>
</div>
<div id="B">
<div id="river">
<div id="ship" name="ship"></div>
<div id="ship" name="ship"></div>
</div>
<div id="operator">
<div id="btns">
<div id="btn">縐誨姩</div>
<div id="new">閲嶇帺</div>
</div>
<div id="rule">
娓告垙瑙勫垯錛?lt;br />
1.鏃犺澶т漢銆佸皬瀛╋紝姣忔鏈澶氬彧鑳芥壙杞戒袱浜恒?.鍙湁鐖哥埜銆佸濡堛佽瀵熷彲浠ラ┚鑸廣?lt;br />
3.濡堝鐪嬪埌鐖哥埜紱誨紑鍎垮瓙鎵撳効瀛愩?.鐖哥埜鐪嬪埌濡堝紱誨紑濂沖効鎵撳コ鍎褲?lt;br />
5.鍦熷尓紱誨紑璀﹀療浼?xì)浼ゅ疀_浜恒?.鍏堥夋嫨浜虹墿錛岀劧鍚庣偣鍑?縐誨姩"鎸夐挳銆?lt;br />
7.縐誨姩榪囩▼涓嫢鍑虹幇鎻愮ず錛岃鏄庤繚鍙嶄笂榪拌鍒欍?br /></div>
</div>
</div>
<div id="C">
<div id="people" name="people">濡堝</div>
<div id="people" name="people">濂沖効1</div>
<div id="people" name="people">濂沖効2</div>
<div id="people" name="people">鐖哥埜</div>
<div id="people" name="people">鍎垮瓙1</div>
<div id="people" name="people">鍎垮瓙2</div>
<div id="people" name="people">璀﹀療</div>
<div id="people" name="people">鍦熷尓</div>
</div>
</div>
</body>
</html>
var selectChar = new Array(2,3,4,5,6,7,8,9,'A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X','Y','Z');
for(var i=0;i<codeLength;i++) {
var charIndex = Math.floor(Math.random()*32);
code +=selectChar[charIndex];
}
if(code.length != codeLength){
createCode();
}
checkCode.value = code;
}
function validate () {
var inputCode = document.getElementById("input1").value.toUpperCase();
if(inputCode.length <=0) {
alert("璇瘋緭鍏ラ獙璇佺爜錛?);
return false;
}
else if(inputCode != code ){
alert("楠岃瘉鐮佽緭鍏ラ敊璇紒");
createCode();
return false;
}
else {
alert("OK");
return true;
}
}
</script>
</head>
<body onload="createCode();">
<input type="text" id="input1" />
<input type="text" id="checkCode" class="code" style="width: 55px" /> <a href="#" onclick="createCode()">鐪嬩笉娓呮</a><br /><br />
<center><input id="Button1" onclick="validate();" type="button" value="紜畾" /></center>
<script></script>
</body>
</html>
function WeekDay(date){
var theDate;
if (typeof(date)=="string"){theDate = new Date(date.split("-")[0],date.split("-")[1],date.split("-")[2]);}
if (typeof(date)=="object"){theDate = date}
return theDate.getDay();
}
function HS_calender(){
var lis = "";
var style = "";
style +="<style type='text/css'>";
style +=".calender { width:170px; height:auto; font-size:12px; margin-right:14px; background:url(calenderbg.gif) no-repeat right center #fff; border:1px solid #397EAE; padding:1px}";
style +=".calender ul {list-style-type:none; margin:0; padding:0;}";
style +=".calender .day { background-color:#EDF5FF; height:20px;}";
style +=".calender .day li,.calender .date li{ float:left; width:14%; height:20px; line-height:20px; text-align:center}";
style +=".calender li a { text-decoration:none; font-family:Tahoma; font-size:11px; color:#333}";
style +=".calender li a:hover { color:#f30; text-decoration:underline}";
style +=".calender li a.hasArticle {font-weight:bold; color:#f60 !important}";
style +=".lastMonthDate, .nextMonthDate {color:#bbb;font-size:11px}";
style +=".selectThisYear a, .selectThisMonth a{text-decoration:none; margin:0 2px; color:#000; font-weight:bold}";
style +=".calender .LastMonth, .calender .NextMonth{ text-decoration:none; color:#000; font-size:18px; font-weight:bold; line-height:16px;}";
style +=".calender .LastMonth { float:left;}";
style +=".calender .NextMonth { float:right;}";
style +=".calenderBody {clear:both}";
style +=".calenderTitle {text-align:center;height:20px; line-height:20px; clear:both}";
style +=".today { background-color:#ffffaa;border:1px solid #f60; padding:2px}";
style +=".today a { color:#f30; }";
style +=".calenderBottom {clear:both; border-top:1px solid #ddd; padding: 3px 0; text-align:left}";
style +=".calenderBottom a {text-decoration:none; margin:2px !important; font-weight:bold; color:#000}";
style +=".calenderBottom a.closeCalender{float:right}";
style +=".closeCalenderBox {float:right; border:1px solid #000; background:#fff; font-size:9px; width:11px; height:11px; line-height:11px; text-align:center;overflow:hidden; font-weight:normal !important}";
style +="</style>";
var now;
if (typeof(arguments[0])=="string"){
selectDate = arguments[0].split("-");
var year = selectDate[0];
var month = parseInt(selectDate[1])-1+"";
var date = selectDate[2];
now = new Date(year,month,date);
}else if (typeof(arguments[0])=="object"){
now = arguments[0];
}
var lastMonthEndDate = HS_DateAdd("d","-1",now.getFullYear()+"-"+now.getMonth()+"-01").getDate();
var lastMonthDate = WeekDay(now.getFullYear()+"-"+now.getMonth()+"-01");
var thisMonthLastDate = HS_DateAdd("d","-1",now.getFullYear()+"-"+(parseInt(now.getMonth())+1).toString()+"-01");
var thisMonthEndDate = thisMonthLastDate.getDate();
var thisMonthEndDay = thisMonthLastDate.getDay();
var todayObj = new Date();
today = todayObj.getFullYear()+"-"+todayObj.getMonth()+"-"+todayObj.getDate();
for (i=0; i<lastMonthDate; i++){ // Last Month's Date
lis = "<li class='lastMonthDate'>"+lastMonthEndDate+"</li>" + lis;
lastMonthEndDate--;
}
for (i=1; i<=thisMonthEndDate; i++){ // Current Month's Date
if(today == now.getFullYear()+"-"+now.getMonth()+"-"+i){
var todayString = now.getFullYear()+"-"+(parseInt(now.getMonth())+1).toString()+"-"+i;
lis += "<li><a href=javascript:void(0) class='today' onclick='_selectThisDay(this)' title='"+now.getFullYear()+"-"+(parseInt(now.getMonth())+1)+"-"+i+"'>"+i+"</a></li>";
}else{
lis += "<li><a href=javascript:void(0) onclick='_selectThisDay(this)' title='"+now.getFullYear()+"-"+(parseInt(now.getMonth())+1)+"-"+i+"'>"+i+"</a></li>";
}
}
var j=1;
for (i=thisMonthEndDay; i<6; i++){ // Next Month's Date
lis += "<li class='nextMonthDate'>"+j+"</li>";
j++;
}
lis += style;
var CalenderTitle = "<a href='javascript:void(0)' class='NextMonth' onclick=HS_calender(HS_DateAdd('m',1,'"+now.getFullYear()+"-"+now.getMonth()+"-"+now.getDate()+"'),this) title='Next Month'>»</a>";
CalenderTitle += "<a href='javascript:void(0)' class='LastMonth' onclick=HS_calender(HS_DateAdd('m',-1,'"+now.getFullYear()+"-"+now.getMonth()+"-"+now.getDate()+"'),this) title='Previous Month'>«</a>";
CalenderTitle += "<span class='selectThisYear'><a href='javascript:void(0)' onclick='CalenderselectYear(this)' title='Click here to select other year' >"+now.getFullYear()+"</a></span>騫?lt;span class='selectThisMonth'><a href='javascript:void(0)' onclick='CalenderselectMonth(this)' title='Click here to select other month'>"+(parseInt(now.getMonth())+1).toString()+"</a></span>鏈?;
if (arguments.length>1){
arguments[1].parentNode.parentNode.getElementsByTagName("ul")[1].innerHTML = lis;
arguments[1].parentNode.innerHTML = CalenderTitle;
}else{
var CalenderBox = style+"<div class='calender'><div class='calenderTitle'>"+CalenderTitle+"</div><div class='calenderBody'><ul class='day'><li>鏃?lt;/li><li>涓</li><li>浜?lt;/li><li>涓?lt;/li><li>鍥?lt;/li><li>浜?lt;/li><li>鍏?lt;/li></ul><ul class='date' id='thisMonthDate'>"+lis+"</ul></div><div class='calenderBottom'><a href='javascript:void(0)' class='closeCalender' onclick='closeCalender(this)'>×</a><span><span><a href=javascript:void(0) onclick='_selectThisDay(this)' title='"+todayString+"'>Today</a></span></span></div></div>";
return CalenderBox;
}
}
function _selectThisDay(d){
var boxObj = d.parentNode.parentNode.parentNode.parentNode.parentNode;
boxObj.targetObj.value = d.title;
boxObj.parentNode.removeChild(boxObj);
}
function closeCalender(d){
var boxObj = d.parentNode.parentNode.parentNode;
boxObj.parentNode.removeChild(boxObj);
}
function CalenderselectYear(obj){
var opt = "";
var thisYear = obj.innerHTML;
for (i=1970; i<=2020; i++){
if (i==thisYear){
opt += "<option value="+i+" selected>"+i+"</option>";
}else{
opt += "<option value="+i+">"+i+"</option>";
}
}
opt = "<select onblur='selectThisYear(this)' onchange='selectThisYear(this)' style='font-size:11px'>"+opt+"</select>";
obj.parentNode.innerHTML = opt;
}
function selectThisYear(obj){
HS_calender(obj.value+"-"+obj.parentNode.parentNode.getElementsByTagName("span")[1].getElementsByTagName("a")[0].innerHTML+"-1",obj.parentNode);
}
function CalenderselectMonth(obj){
var opt = "";
var thisMonth = obj.innerHTML;
for (i=1; i<=12; i++){
if (i==thisMonth){
opt += "<option value="+i+" selected>"+i+"</option>";
}else{
opt += "<option value="+i+">"+i+"</option>";
}
}
opt = "<select onblur='selectThisMonth(this)' onchange='selectThisMonth(this)' style='font-size:11px'>"+opt+"</select>";
obj.parentNode.innerHTML = opt;
}
function selectThisMonth(obj){
HS_calender(obj.parentNode.parentNode.getElementsByTagName("span")[0].getElementsByTagName("a")[0].innerHTML+"-"+obj.value+"-1",obj.parentNode);
}
function HS_setDate(inputObj){
var calenderObj = document.createElement("span");
calenderObj.innerHTML = HS_calender(new Date());
calenderObj.style.position = "absolute";
calenderObj.targetObj = inputObj;
inputObj.parentNode.insertBefore(calenderObj,inputObj.nextSibling);
}
function onclick_check2() {
var popup_width = 400;
var popup_height = 350;
var popup_left = (screen.width - popup_width) / 2;
var popup_top = (screen.height - popup_height) / 2;
var popup_scrollbars = "no";
var popup_property = "width=" + popup_width;
var popup_property = popup_property + ",height=" + popup_height;
var popup_property = popup_property + ",left=" + popup_left;
var popup_property = popup_property + ",top=" + popup_top;
var popup_property = popup_property + ",scrollbars=" + popup_scrollbars;
window.open('<%=request.getContextPath()%>/commu/pop_post.jsp','zipcode',popup_property);
}
/*
鐩綍:
1:js 瀛楃涓查暱搴﹂檺鍒躲佸垽鏂瓧絎﹂暱搴?銆乯s闄愬埗杈撳叆銆侀檺鍒朵笉鑳借緭鍏ャ乼extarea 闀垮害闄愬埗
2.:js鍒ゆ柇姹夊瓧銆佸垽鏂槸鍚︽眽瀛?銆佸彧鑳借緭鍏ユ眽瀛?/p>
3:js鍒ゆ柇鏄惁杈撳叆鑻辨枃銆佸彧鑳借緭鍏ヨ嫳鏂?/p>
4:js鍙兘杈撳叆鏁板瓧,鍒ゆ柇鏁板瓧銆侀獙璇佹暟瀛椼佹嫻嬫暟瀛椼佸垽鏂槸鍚︿負(fù)鏁板瓧銆佸彧鑳借緭鍏ユ暟瀛?/p>
5:鍙兘杈撳叆鑻辨枃瀛楃鍜屾暟瀛?/p>
6: js email楠岃瘉 銆乯s 鍒ゆ柇email 銆佷俊綆?閭鏍煎紡楠岃瘉
7:js瀛楃榪囨護(hù),灞忚斀鍏抽敭瀛?/p>
8:js瀵嗙爜楠岃瘉銆佸垽鏂瘑鐮?
2.1: js 涓嶄負(fù)絀恒佷負(fù)絀烘垨涓嶆槸瀵硅薄 銆佸垽鏂負(fù)絀?銆佸垽鏂笉涓虹┖
2.2:姣旇緝涓や釜琛ㄥ崟欏圭殑鍊兼槸鍚︾浉鍚?/p>
2.3:琛ㄥ崟鍙兘涓烘暟瀛楀拰"_",
2.4:琛ㄥ崟欏硅緭鍏ユ暟鍊?闀垮害闄愬畾
2.5:涓枃/鑻辨枃/鏁板瓧/閭歡鍦板潃鍚堟硶鎬у垽鏂?/p>
2.6:闄愬畾琛ㄥ崟欏逛笉鑳借緭鍏ョ殑瀛楃
2.7琛ㄥ崟鐨勮嚜絎︽帶鍒?/p>
1. 媯鏌ヤ竴孌靛瓧絎︿覆鏄惁鍏ㄧ敱鏁板瓧緇勬垚
2. 鎬庝箞鍒ゆ柇鏄惁鏄瓧絎?/p>
3. 鎬庝箞鍒ゆ柇鏄惁鍚湁姹夊瓧
4. 閭鏍煎紡楠岃瘉
5. 鏁板瓧鏍煎紡楠岃瘉
6. 鐢?shù)璇濆忥L(fēng)爜鏍煎紡楠岃瘉
7. 鍒ゆ柇杈撳叆鏄惁涓轟腑鏂囩殑鍑芥暟
8. 緇煎悎鐨勫垽鏂敤鎴瘋緭鍏ョ殑鍚堟硶鎬х殑鍑芥暟
9. 鍒ゆ柇瀵嗙爜鏄惁杈撳叆涓鑷?/p>
10. 鍒ゆ柇鐢ㄦ埛鍚嶆槸鍚︿負(fù)鏁板瓧瀛楁瘝涓嬫粦綰?/p>
2.8:form鏂囨湰鍩熺殑閫氱敤鏍¢獙鍑芥暟
*/
1. 闀垮害闄愬埗
<script>
function test()
{
if(document.a.b.value.length>50)
{
alert("涓嶈兘瓚呰繃50涓瓧絎︼紒");
document.a.b.focus();
return false;
}
}
</script>
<form name=a onsubmit="return test()">
<textarea name="b" cols="40" wrap="VIRTUAL" rows="6"></textarea>
<input type="submit" name="Submit" value="check">
</form>
2. 鍙兘鏄眽瀛?
<input onkeyup="value="/oblog/value.replace(/[^\u4E00-\u9FA5]/g,'')">
3." 鍙兘鏄嫳鏂?/p>
<script language=javascript>
function onlyEng()
{
if(!(event.keyCode>=65&&event.keyCode<=90))
event.returnvalue=false;
}
</script>
<input onkeydown="onlyEng();">
4. 鍙兘鏄暟瀛?/p>
<script language=javascript>
function onlyNum()
{
if(!((event.keyCode>=48&&event.keyCode<=57)||(event.keyCode>=96&&event.keyCode<=105)))
//鑰冭檻灝忛敭鐩樹笂鐨勬暟瀛楅敭
event.returnvalue=false;
}
</script>
<input onkeydown="onlyNum();">
5. 鍙兘鏄嫳鏂囧瓧絎﹀拰鏁板瓧
<input onkeyup="value="/oblog/value.replace(/[\W]/g,"'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))">
6. 楠岃瘉娌圭鏍煎紡
<SCRIPT LANGUAGE=javascript RUNAT=Server>
function isEmail(strEmail) {
if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true;
else
alert("oh");
}
</SCRIPT>
<input type=text onblur=isEmail(this.value)>
7. 灞忚斀鍏抽敭瀛?榪欓噷灞忚斀***鍜?***)
<script language="javascript1.2">
function test() {
if((a.b.value.indexOf ("***") == 0)||(a.b.value.indexOf ("****") == 0)){
alert(":)");
a.b.focus();
return false;}
}
</script>
<form name=a onsubmit="return test()">
<input type=text name=b>
<input type="submit" name="Submit" value="check">
</form>
8. 涓ゆ杈撳叆瀵嗙爜鏄惁鐩稿悓
<FORM METHOD=POST ACTION="">
<input type="password" id="input1">
<input type="password" id="input2">
<input type="button" value="test" onclick="check()">
</FORM>
<script>
function check()
{
with(document.all){
if(input1.value!=input2.value)
{
alert("false")
input1.value = "";
input2.value = "";
}
else document.forms[0].submit();
}
}
</script>
澶熶簡鍚?:)
灞忚斀鍙抽敭 寰堥叿
oncontextmenu="return false" ondragstart="return false" onselectstart="return false"
鍔犲湪body涓?/p>
浜?/p>
2.1 琛ㄥ崟欏逛笉鑳戒負(fù)絀?/p>
<script language="javascript">
<!--
function CheckForm()
{
if (document.form.name.value.length == 0) {
alert("璇瘋緭鍏ユ?zhèn)ㄥ鍚?");
document.form.name.focus();
return false;
}
return true;
}
-->
</script>
2.2 姣旇緝涓や釜琛ㄥ崟欏圭殑鍊兼槸鍚︾浉鍚?/p>
<script language="javascript">
<!--
function CheckForm()
if (document.form.PWD.value != document.form.PWD_Again.value) {
alert("鎮(zhèn)ㄤ袱嬈¤緭鍏ョ殑瀵嗙爜涓嶄竴鏍鳳紒璇烽噸鏂拌緭鍏?");
document.ADDUser.PWD.focus();
return false;
}
return true;
}
-->
</script>
2.3 琛ㄥ崟欏瑰彧鑳戒負(fù)鏁板瓧鍜?_",鐢ㄤ簬鐢?shù)璇?閾惰甯愬彿楠岃瘉涓?鍙墿灞曞埌鍩熷悕娉ㄥ唽絳?/p>
<script language="javascript">
<!--
function isNumber(String)
{
var Letters = "1234567890-"; //鍙互鑷繁澧炲姞鍙緭鍏ュ?/p>
var i;
var c;
if(String.charAt( 0 )=='-')
return false;
if( String.charAt( String.length - 1 ) == '-' )
return false;
for( i = 0; i < String.length; i ++ )
{
c = String.charAt( i );
if (Letters.indexOf( c ) < 0)
return false;
}
return true;
}
function CheckForm()
{
if(! isNumber(document.form.TEL.value)) {
alert("鎮(zhèn)ㄧ殑鐢?shù)璇濆忥L(fēng)爜涓嶅悎娉曪紒");
document.form.TEL.focus();
return false;
}
return true;
}
-->
</script>
2.4 琛ㄥ崟欏硅緭鍏ユ暟鍊?闀垮害闄愬畾
<script language="javascript">
<!--
function CheckForm()
{
if (document.form.count.value > 100 || document.form.count.value < 1)
{
alert("杈撳叆鏁板間笉鑳藉皬浜庨浂澶т簬100!");
document.form.count.focus();
return false;
}
if (document.form.MESSAGE.value.length<10)
{
alert("杈撳叆鏂囧瓧灝忎簬10!");
document.form.MESSAGE.focus();
return false;
}
return true;
}
//-->
</script>
2.5 涓枃/鑻辨枃/鏁板瓧/閭歡鍦板潃鍚堟硶鎬у垽鏂?/p>
<SCRIPT LANGUAGE="javascript">
<!--
function isEnglish(name) //鑻辨枃鍊兼嫻?/p>
{
if(name.length == 0)
return false;
for(i = 0; i < name.length; i++) {
if(name.charCodeAt(i) > 128)
return false;
}
return true;
}
function isChinese(name) //涓枃鍊兼嫻?/p>
{
if(name.length == 0)
return false;
for(i = 0; i < name.length; i++) {
if(name.charCodeAt(i) > 128)
return true;
}
return false;
}
function isMail(name) // E-mail鍊兼嫻?/p>
{
if(! isEnglish(name))
return false;
i = name.indexOf(" at ");
j = name dot lastIndexOf(" at ");
if(i == -1)
return false;
if(i != j)
return false;
if(i == name dot length)
return false;
return true;
}
function isNumber(name) //鏁板兼嫻?/p>
{
if(name.length == 0)
return false;
for(i = 0; i < name.length; i++) {
if(name.charAt(i) < "0" || name.charAt(i) > "9")
return false;
}
return true;
}
function CheckForm()
{
if(! isMail(form.Email.value)) {
alert("鎮(zhèn)ㄧ殑鐢?shù)瀛愰偖錃g涓嶅悎娉曪紒");
form.Email.focus();
return false;
}
if(! isEnglish(form.name.value)) {
alert("鑻辨枃鍚嶄笉鍚堟硶錛?);
form.name.focus();
return false;
}
if(! isChinese(form.cnname.value)) {
alert("涓枃鍚嶄笉鍚堟硶錛?);
form.cnname.focus();
return false;
}
if(! isNumber(form.PublicZipCode.value)) {
alert("閭斂緙栫爜涓嶅悎娉曪紒");
form.PublicZipCode.focus();
return false;
}
return true;
}
//-->
</SCRIPT>
2.6 闄愬畾琛ㄥ崟欏逛笉鑳借緭鍏ョ殑瀛楃
<script language="javascript">
<!--
function contain(str,charset)// 瀛楃涓插寘鍚祴璇曞嚱鏁?/p>
{
var i;
for(i=0;i<charset.length;i++)
if(str.indexOf(charset.charAt(i))>=0)
return true;
return false;
}
function CheckForm()
{
if ((contain(document.form.NAME.value, "%\(\)><")) || (contain(document.form.MESSAGE.value, "%\(\)><")))
{
alert("杈撳叆浜嗛潪娉曞瓧絎?);
document.form.NAME.focus();
return false;
}
return true;
}
//-->
</script>
1. 媯鏌ヤ竴孌靛瓧絎︿覆鏄惁鍏ㄧ敱鏁板瓧緇勬垚
---------------------------------------
<script language="Javascript"><!--
function checkNum(str){return str.match(/\D/)==null}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
// --></script>
2. 鎬庝箞鍒ゆ柇鏄惁鏄瓧絎?
---------------------------------------
if (/[^\x00-\xff]/g.test(s)) alert("鍚湁姹夊瓧");
else alert("鍏ㄦ槸瀛楃");
3. 鎬庝箞鍒ゆ柇鏄惁鍚湁姹夊瓧
---------------------------------------
if (escape(str).indexOf("%u")!=-1) alert("鍚湁姹夊瓧");
else alert("鍏ㄦ槸瀛楃");
4. 閭鏍煎紡楠岃瘉
---------------------------------------
//鍑芥暟鍚嶏細(xì)chkemail
//鍔熻兘浠嬬粛錛氭鏌ユ槸鍚︿負(fù)Email Address
//鍙傛暟璇存槑錛氳媯鏌ョ殑瀛楃涓?
//榪斿洖鍊鹼細(xì)0錛氫笉鏄?1錛氭槸
function chkemail(a)
{ var i=a.length;
var temp = a.indexOf('@');
var tempd = a.indexOf('.');
if (temp > 1) {
if ((i-temp) > 3){
if ((i-tempd)>0){
return 1;
}
}
}
return 0;
}
5. 鏁板瓧鏍煎紡楠岃瘉
---------------------------------------
//鍑芥暟鍚嶏細(xì)fucCheckNUM
//鍔熻兘浠嬬粛錛氭鏌ユ槸鍚︿負(fù)鏁板瓧
//鍙傛暟璇存槑錛氳媯鏌ョ殑鏁板瓧
//榪斿洖鍊鹼細(xì)1涓烘槸鏁板瓧錛?涓轟笉鏄暟瀛?
function fucCheckNUM(NUM)
{
var i,j,strTemp;
strTemp="0123456789";
if ( NUM.length== 0)
return 0
for (i=0;i<NUM.length;i++)
{
j=strTemp.indexOf(NUM.charAt(i));
if (j==-1)
{
//璇存槑鏈夊瓧絎︿笉鏄暟瀛?
return 0;
}
}
//璇存槑鏄暟瀛?
return 1;
}
6. 鐢?shù)璇濆忥L(fēng)爜鏍煎紡楠岃瘉
---------------------------------------
//鍑芥暟鍚嶏細(xì)fucCheckTEL
//鍔熻兘浠嬬粛錛氭鏌ユ槸鍚︿負(fù)鐢?shù)璇濆忥L(fēng)爜
//鍙傛暟璇存槑錛氳媯鏌ョ殑瀛楃涓?
//榪斿洖鍊鹼細(xì)1涓烘槸鍚堟硶錛?涓轟笉鍚堟硶
function fucCheckTEL(TEL)
{
var i,j,strTemp;
strTemp="0123456789-()# ";
for (i=0;i<TEL.length;i++)
{
j=strTemp.indexOf(TEL.charAt(i));
if (j==-1)
{
//璇存槑鏈夊瓧絎︿笉鍚堟硶
return 0;
}
}
//璇存槑鍚堟硶
return 1;
}
7. 鍒ゆ柇杈撳叆鏄惁涓轟腑鏂囩殑鍑芥暟
---------------------------------------
function ischinese(s){
var ret=true;
for(var i=0;i<s.length;i++)
ret=ret && (s.charCodeAt(i)>=10000);
return ret;
}
8. 緇煎悎鐨勫垽鏂敤鎴瘋緭鍏ョ殑鍚堟硶鎬х殑鍑芥暟
---------------------------------------
<script language="javascript">
//闄愬埗杈撳叆瀛楃鐨勪綅鏁板紑濮?
//m鏄敤鎴瘋緭鍏ワ紝n鏄闄愬埗鐨勪綅鏁?
function issmall(m,n)
{
if ((m<n) && (m>0))
{
return(false);
}
else
{return(true);}
}
9. 鍒ゆ柇瀵嗙爜鏄惁杈撳叆涓鑷?
---------------------------------------
function issame(str1,str2)
{
if (str1==str2)
{return(true);}
else
{return(false);}
}
10. 鍒ゆ柇鐢ㄦ埛鍚嶆槸鍚︿負(fù)鏁板瓧瀛楁瘝涓嬫粦綰?
---------------------------------------
function notchinese(str){
var reg=/[^A-Za-z0-9_]/g
if (reg.test(str)){
return (false);
}else{
return(true); }
}
2.8. form鏂囨湰鍩熺殑閫氱敤鏍¢獙鍑芥暟
---------------------------------------
浣滅敤錛氭嫻嬫墍鏈夊繀欏婚潪絀虹殑input鏂囨湰錛屾瘮濡傚鍚嶏紝璐﹀彿錛岄偖浠跺湴鍧絳夌瓑銆?/p>
璇ユ牎楠岀幇鍦ㄥ彧閽堝鏂囨湰鍩燂紝濡傛灉瑕侀拡瀵筬orm閲岄潰鐨勫叾浠栧煙瀵硅薄錛屽彲浠ユ敼鍙樺垽鏂潯浠躲?/p>
浣跨敤鏂規(guī)硶錛氬湪瑕佹嫻嬬殑鏂囨湰鍩熶腑鍔犲叆title鏂囧瓧銆傛枃瀛楁槸鍦ㄦ彁紺轟俊鎭紝浣犺鎻愮ず緇欑敤鎴風(fēng)殑璇ュ瓧孌電殑涓枃鍚嶃傛瘮濡傝媯嫻嬬敤鎴峰悕
html濡備笅<input name="txt_1" title="濮撳悕">,褰撶劧錛屾渶濂界敤鍙鍖栧伐鍏鋒瘮濡俤reamweaver浠涔堢殑鏉ョ紪杈戝煙銆?/p>
濡傛灉瑕佹嫻嬫暟瀛楃被鍨嬫暟鎹殑璇濓紝鍐嶆妸鍩熺殑id緇熶竴涓簊z.
javascript鍒ゆ柇鏃ユ湡綾誨瀷姣旇緝楹葷儲錛屾墍浠ュ氨娌℃湁鍋氭棩鏈熺被鍨嬫牎楠岀殑紼嬪簭浜?楂樻墜鍙互琛ュ厖銆?/p>
紼嬪簭姣旇緝鑽夛紝鍙槸鎻愪緵涓涓濊礬銆傛姏鐮栧紩鐜夛紒 錛氾級
鍝︼紝瀵逛簡錛屽嚱鏁拌皟鐢ㄦ柟娉曪細(xì)< form onsubmit="return dovalidate()">
function dovalidate()
{
fm=document.forms[0] //鍙嫻嬩竴涓猣orm,濡傛灉鏄涓彲浠ユ敼鍙樺垽鏂潯浠?/p>
for(i=0;i<fm.length;i++)
{
//媯嫻嬪垽鏂潯浠訛紝鏍規(guī)嵁綾誨瀷涓嶅悓鍙互淇敼
if(fm[i].tagName.toUpperCase()=="INPUT" &&fm[i].type.toUpperCase()=="TEXT" && (fm[i].title!=""))
if(fm[i].value="/blog/="")//
{
str_warn1=fm[i].title+"涓嶈兘涓虹┖!";
alert(str_warn1);
fm[i].focus();
return false;
}
if(fm[i].id.toUpperCase()=="SZ")//鏁板瓧鏍¢獙
{
if(isNaN(fm[i].value))
{ str_warn2=fm[i].title+"鏍煎紡涓嶅";
alert(str_warn2);
fm[i].focus();
return false;
}
}
}
return true;
}