1、 jsp 頁面的保留字問題(主要是表格的問題)
< TABLE class = "border" >
< TBODY >
< TR >
< TD >
< P class = "title" >< bean:message key = "RoomRent.insert.title" /></ P >
< html:errors />
< bean:write name = "roomTotalRentForm"
property = "message" filter = "false" />
< DIV class = "tab-pane" >
< DIV class = "tab-page" >
< DIV class = "tab" >< bean:message key = "RoomRentData.add" /></ DIV >
< TABLE border = "1" width = "100%" >
< TBODY >
< TH nowrap align = "left" >< bean:message key = "RoomRentData.length" /></ TH >
< TD >< html:text property = 'roomrentData.length' size = "20"
maxlength = "20" styleId = "length" onblur = "checkLength(length10,20,' 長 ')" ></ html:text ></ TD >
< TH nowrap align = "left" >< bean:message key = "RoomRentData.width" /></ TH >
< TD >< html:text property = 'roomrentData.width' size = "20"
maxlength = "20" styleId = "width" onblur = "checkLength(width10,20,' 寬 ')" ></ html:text ></ TD >
< TH nowrap align = "left" >< bean:message key = "RoomRentData.area" /></ TH >
< TD >< html:text property = 'roomrentData.area' size = "20"
maxlength = "20" styleId = "area" onclick = "getArea()" onblur = "checkLength(area,20,' 面積 ');getArea()" ></ html:text ></ TD >
</ TR >
< TR >
< TD colspan = "6" align = "center" nowrap >< html:button
property = "Save" onclick = "toSave()" styleClass = "button" >
< bean:message key = "dataEdit.saveEdit" />
</ html:button >
< html:button property = "Return" onclick = "toReturn()"
styleClass = "button" >
< bean:message key = "dataEdit.return" />
</ html:button ></ TD >
</ TR >
</ TBODY >
</ TABLE >
</ DIV >
</ DIV >
</ TD >
</ TR >
</ TBODY >
</ TABLE >
上面的代碼邏輯和語法上沒任何錯誤,但是在 css 樣式顯示的時候, <TH> 可以正常顯示樣式可 <TD> 就不可以。原因是 <TD> 中出現了關鍵字 length 和 width 直接使的定義的樣式不能正常顯示。
2、 多表關聯查詢
Select new rent.data.RoomTotalRentData(rtr.rentId,rtr.roomId, rm.builderId,rm.unit,rm.floor,rm.room,rtr.rentRoomArea,rtr.balconyUseArea,rtr.roomType, rtr.roomDirectiond1.dictItemName,d2.dictItemName,hb.buildName)from pub.data.RoomTotalRent as rtr, pub.data.SysDictItem as d1, pub.data.SysDictItem as d2,.pub.data.HouseBuilding as hb, pub.data.RoomMng as rm , pub.data.operator as op where rtr.roomType=d1.dictItemId and d1.dictId='000212' and rtr.roomDirection=d2.dictItemId and d2.dictId='000210' and rm.roomId=rtr.roomId and rm.builderId=hb.buildId
可以保證 rent.data.RoomTotalRentData 裏面即 vo 裏面有這個構造函數,而且字典,關聯也都沒有錯誤。可是在查詢出來的結果卻有沒有達到效果。原因就是關聯了 pub.data.operator 表但是沒有使用這個條件。所以結果就是查詢的符合條件的記錄關聯 pub.data.operator 表中的記錄。
3、 單選按鈕控制文本框的隱藏和顯示
就是選中一個 radio 就顯示一個文本框 選中另外的就顯示另外的文本框沒有顯示的就隱藏
使用 tr 的 style.display 控制顯示和隱藏的。不多說了,看代碼吧!
Js 代碼
function setDisplay()
{ with (document.forms[0])
{if (document.forms[0].subsideStatment[0].checked==1) {
document.all( 'costRenth' ).style.display= "" ;
} else
{ document.all( 'costRenth' ).style.display= "none" ;
}if (document.forms[0].subsideStatment[1].checked==1)
{ document.all( 'rlevelRenth' ).style.display= "" ;
}else
{ document.all( 'rlevelRenth' ).style.display= "none" ;
} if (document.forms[0].subsideStatment[2].checked==1)
{ document.all( 'levelRenth' ).style.display= "" ;
}else
{ document.all( 'levelRenth' ).style.display= "none" ;
}
}
}
Jsp 代碼
< TR >
< TH nowrap align = "left" >< bean:message key = "RoomTotalRentData.subsideStatment" /> < font color = "red" > * </ font ></ TH >
< TD colspan = "7" >< html:radio property = "data.subsideStatment"
value = "213001" styleId = "subsideStatment" onclick = "setDisplay()" onblur = "setDisplay()" >< bean:message key = "RoomTotalRentData.subsideStatment.all" />
</ html:radio > < html:radio property = "data.subsideStatment"
value = "213002" styleId = "subsideStatment" onclick = "setDisplay()"
onblur = "setDisplay()" >< bean:message key = "RoomTotalRentData.subsideStatment.part" /></ html:radio > < html:radio property = "data.subsideStatment" value = "213003" styleId = "subsideStatment" onclick = "setDisplay()" onblur = "setDisplay()" >< bean:message key = "RoomTotalRentData.subsideStatment.no" />
</ html:radio ></ TD >
</ TR >
< TR id = "costRenth" style = "display:none" >
< TH nowrap align = "left" >< bean:message key = "RoomTotalRentData.costRent" /></ TH >
< TD colspan = "7" >< html:text property = "data.costRent" styleId = "costRent" size = "10" maxlength = "20" onblur = "checkLength(costRent,20,' 成本租金 ');isNum(costRent,' 成本租金 ')" ></ html:text >
</ TD >
</ TR >
< TR id = "rlevelRenth" style = "display:none" >
< TH nowrap align = "left" >< bean:message key = "RoomTotalRentData.rlevelRent" /></ TH >
< TD colspan = "7" >< html:text property = "data.rlevelRent" styleId = "rlevelRent" size = "10" maxlength = "20"
onblur = "checkLength(rlevelRent,20,' 準成本租金 ');isNum(rlevelRent,' 準成本租金 ') " ></ html:text >
</ TD >
</ TR >
< TR id = "levelRenth" style = "display:none" >< TH nowrap align = "left" >< bean:message key = "RoomTotalRentData.levelRent" /></ TH >
< TD colspan = "7" >< html:text property = "data.levelRent"
styleId = "levelRent" size = "10" maxlength = "20 onblur = "checkLength(levelRent,20,' 基準租金 ');isNum(levelRent,' 基準租金 ') " ></ html:text >
</ TD >
</ TR >
4、 下拉列表顯示和隱藏文本框
同單選按鈕
Js 代碼
function casCade()
{if (document.forms[0].roomType.value== "212001" )
{ document.all( 'totalFloorb' ).style.display= "none" ;
document.all( 'totalFloort' ).style.display= "none" ;
document.all( 'roomDirectionc' ).colSpan=6;
}if (document.forms[0].roomType.value== "212002" )
{ document.all( 'totalFloorb' ).style.display= "" ;
document.all( 'totalFloort' ).style.display= "" ;
document.all( 'roomDirectionc' ).colSpan=1;
}
}
Jsp 代碼
< TD id = "roomDirectionc" colspan = "6" >< html:select property = "data.roomDirection" styleId = "roomDirections" styleClass = "iform" onclick = "casCade()" >
< html:option value = "" />
< html:options collection = "roomDirectionList"
property = "dictItemId" labelProperty = "dictItemName" />
</ html:select ></ TD >
< TH nowrap align = "left" id = "totalFloorb" style = "display:none" >< bean:message
key = "RoomTotalRentData.totalFloor" /></ TH >
< TD colspan = "3" id = "totalFloort" style = "display:none" >< html:text
property = "data.totalFloor" styleId = "totalFloor" size = "10" maxlength = "20" onblur = "checkLength(totalFloor,20,' 樓房總樓層 ');isInt(totalFloor,' 樓房總樓層 ')" readonly = "true" ></ html:text ></ TD >
5、 xp 下面可以裝 sql2000 。方法是:先進入 sql 的安裝光盤找到 msde 目錄,裏面有個 setup ,安裝後重啓一遍系統就會發現已經有了服務管理器了,然後在照常安裝 sql2000 就可以了。這樣安裝後的 sql 就和在服務器上安裝的 sql 一樣了。
6、 一個在線的 DHTML 參考手冊 http://www.phpx.com/man/dhtmlcn/ 什麼屬性一查就知很方便的
7、 一個在線的 Javascipt 中文手冊 http://man.ddvip.com/web/JScriptzhref/index.html