你可以用一个标签,总比新开一页面开销下吧。
可以这样,用2个div,条件判断,我就是这么作的,看看下面代码: <tr>
<% if(hashMapLastState.containsKey(String.valueOf(mList.getID())))
{
%>
<td id='a<%=mList.getID()%>' class="smallquestion" style="display:none">读取数据库<img src="../../../images/fullscreen/noanwser.gif" width="12" height="12" align="absmiddle">δ´ð</td>
<td id='b<%=mList.getID()%>' class="smallquestion" style="display:">浏览数据库<img src="../../../images/anwsered.gif" width="12" height="12" align="absmiddle">ÒÑ´ð</td>
<%
}
else
{
%> <td id='a<%=mList.getID()%>' class="examing-smallquestion" style="display:">״̬£º<img src="../../../images/exam-fullscreen/noanwser.gif" width="12" height="12" align="absmiddle">δ´ð</td>
<td id='b<%=mList.getID()%>' class="examing-smallquestion" style="display:none">״̬£º<img src="../../../images/exam-fullscreen/anwsered.gif" width="12" height="12" align="absmiddle">ÒÑ´ð</td>
<%}%>
</tr>
</table>
</td>
</tr>
可以这样,用2个div,条件判断,我就是这么作的,看看下面代码: <tr>
<% if(hashMapLastState.containsKey(String.valueOf(mList.getID())))
{
%>
<td id='a<%=mList.getID()%>' class="smallquestion" style="display:none">读取数据库<img src="../../../images/fullscreen/noanwser.gif" width="12" height="12" align="absmiddle">δ´ð</td>
<td id='b<%=mList.getID()%>' class="smallquestion" style="display:">浏览数据库<img src="../../../images/anwsered.gif" width="12" height="12" align="absmiddle">ÒÑ´ð</td>
<%
}
else
{
%> <td id='a<%=mList.getID()%>' class="examing-smallquestion" style="display:">״̬£º<img src="../../../images/exam-fullscreen/noanwser.gif" width="12" height="12" align="absmiddle">δ´ð</td>
<td id='b<%=mList.getID()%>' class="examing-smallquestion" style="display:none">״̬£º<img src="../../../images/exam-fullscreen/anwsered.gif" width="12" height="12" align="absmiddle">ÒÑ´ð</td>
<%}%>
</tr>
</table>
</td>
</tr>
解决方案 »
- 对datalist的数据进行查询,并定位
- 有没有什么类似button的控件选择 但是不刷新页面?
- Ajax前台调用后台函数
- 求教关于母版页的问题!!!!!!
- webservice返回值问题 神人进~
- 关于打开无工具栏固定大小的窗口问题,急死我了。
- .net 中用js问题
- FormView如何动态生成模板并绑定数据?
- 怎么才能做到post到另外一个页面上??
- 请问我有一个datarow...我想把我这个datarow中的数据插入到数据库中...(数据库和这个row的结构相同)...请问怎么办....还有我想用这个row
- 怎么实现把页面上的datagrid/datalist上显示的数据导入到excel?
- 我的asp.net 安装完后怎么不能用啊!!!
<HTML xmlns:mytb
xmlns:mymenu
xmlns:t ="urn:schemas-microsoft-com:time" >
<head>
<?IMPORT namespace="mytb" implementation="./HTC/toolbar.htc">
<?IMPORT namespace="mymenu" implementation="./HTC/menu.htc">
<?IMPORT namespace="t" implementation="#default#time2">
<style>
.time { behavior: url(#default#time2) }
</style>
<TITLE>HTML Editor</TITLE><HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="HTML Editor"
BORDER="thick"
BORDERSTYLE="raised"
CAPTION="yes"
ICON="./Images/netpad.ico"
MAXIMIZEBUTTON="yes"
MINIMIZEBUTTON="yes"
SHOWINTASKBAR="yes"
SINGLEINSTANCE="yes"
SYSMENU="yes"
VERSION="1.0"
WINDOWSTATE="normal"/> <script>
window.onload=doInit
//sInitColor is a global variable. It holds the value of the selected color in the color dialog box when it displays
var sInitColor = null;
//sPersistValue holds the value of the saved innerHTML
var sPersistValue
function doInit(){
for (i=0; i<document.all.length; i++)
//ensure that all document elements except the content editable DIV are unselectable
document.all(i).unselectable = "on";
oDiv.unselectable = "off";
//clear any text in the Document window and set the focus
oDiv.innerHTML="";
oDiv.focus();
//call routines to populate the drop-down list boxes on the toolbar
getSystemFonts();
getBlockFormats();
window.resizeTo(730,560);
goContext();
}//This function works for all of the command identifiers used in this page
function callFormatting(sFormatString){
document.execCommand(sFormatString);
}//Fonts routines
//getSystemFonts uses the dialog helper object to return an array of all of the fonts on the user's system, then populates a drop-down listbox in the toolbar with the array elements
function getSystemFonts(){
var a=dlgHelper.fonts.count;
var fArray = new Array();
var oDropDown = oToolBar.createDropDownListAt("4");
oDropDown.setAttribute("id","FontNameList");
for (i = 1;i < dlgHelper.fonts.count;i++){
fArray[i] = dlgHelper.fonts(i);
var aOptions = oDropDown.getOptions();
var oOption = document.createElement("OPTION");
aOptions.add(oOption);
oOption.text = fArray[i];
oOption.Value = i;
}
//attaching the onchange event is necessary in order to detect when a user changes the value in the drop-down listbox
oDropDown.setAttribute("onchange",ChangeFont);
}//changeFontSize detects the value of the item in the drop-down listbox and applies the value to the font of the selected text
function changeFontSize(){
var sSelected=oToolBar.getItem(6).getOptions().item(oToolBar.getItem(6).getAttribute("selectedIndex"));
document.execCommand("FontSize", false, sSelected.value);
}//changeFont detects the value of the item in the drop-down listbox and applies the value to the font of the selected text
function ChangeFont(){
var sSelected=oToolBar.getItem(4).getOptions().item(oToolBar.getItem(4).getAttribute("selectedIndex"));
document.execCommand("FontName", false, sSelected.text);
}//BlockFormats routines
//getBlockFormats uses the dialog helper object to return an array of all of the block formats on the user's system, then populates a drop-down listbox in the toolbar with the array elements
function getBlockFormats(){
var a=dlgHelper.blockFormats.count;
var fArray = new Array();
var oDropDown = oToolBar.createDropDownListAt("5");
oDropDown.setAttribute("id","FormatList");
for (i = 1;i < dlgHelper.blockFormats.count;i++)
{
fArray[i] = dlgHelper.blockFormats(i);
var aOptions = oDropDown.getOptions();
var oOption = document.createElement("OPTION");
aOptions.add(oOption);
oOption.text = fArray[i];
oOption.Value = i;
}
//attach the onchange event
oDropDown.setAttribute("onchange",ChangeFormat);
}
function ChangeFormat(){
var sSelected=oToolBar.getItem(5).getOptions().item(oToolBar.getItem(5).getAttribute("selectedIndex"));
document.execCommand("FormatBlock", false, sSelected.text);
}
//callColorDlg uses the dialog helper object's ChooseColorDlg method to open the color dialog box, then changes the font or back color of the selected text
function callColorDlg(sColorType){if (sInitColor == null)
//display color dialog box
var sColor = dlgHelper.ChooseColorDlg();
else
var sColor = dlgHelper.ChooseColorDlg(sInitColor);
//change decimal to hex
sColor = sColor.toString(16);
//add extra zeroes if hex number is less than 6 digits
if (sColor.length < 6) {
var sTempString = "000000".substring(0,6-sColor.length);
sColor = sTempString.concat(sColor);
}
//change color of the selected text
document.execCommand(sColorType, false, sColor);
sInitColor = sColor;
oDiv.focus();
}//VerticalMode changes the orientation of the text from left to right to top to bottom
function VerticalMode(){
if (oDiv.style.writingMode == 'tb-rl')
oDiv.style.writingMode = 'lr-tb';
else
oDiv.style.writingMode = 'tb-rl';
}//SaveDocument uses the common dialog box object to display the save as dialog, then writes a textstream object from the value of the div's innerHTML property
function SaveDocument(){
//Setting CancelError to true and using try/catch allows the user to click cancel on the save as dialog without causing a script error
cDialog.CancelError=true;
try{
cDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt"
cDialog.ShowSave();
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.CreateTextFile(cDialog.filename, true);
f.write(oDiv.innerHTML);
f.Close();
sPersistValue=oDiv.innerHTML;}
catch(e){
var sCancel="true";
return sCancel;}
oDiv.focus();
}//LoadDocument uses the common dialog box object to display the open dialog box, then reads the file and displays its contents in the div
function LoadDocument(){
//Setting CancelError to true and using try/catch allows the user to click cancel on the save as dialog without causing a script error
cDialog.CancelError=true;
try{
var answer = checkForSave();
//The user has clicked yes in the modal dialog box called in the checkForSave function
if (answer) {var sCancel = SaveDocument();
//The user has clicked cancel in the save as dialog box; exit function
if (sCancel) return;
cDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt"
cDialog.ShowOpen();
var ForReading = 1;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.OpenTextFile(cDialog.filename, ForReading);
var r = f.ReadAll();
f.close();
oDiv.innerHTML=r;
//This variable is used in the checkForSave function to see if there is new content in the div
sPersistValue=oDiv.innerHTML;
}
//The user has clicked no in the modal dialog box called in the checkForSave function
if (answer==false)
{cDialog.Filter="HTM Files (*.htm)|*.htm|Text Files (*.txt)|*.txt"
cDialog.ShowOpen();
var ForReading = 1;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var f = fso.OpenTextFile(cDialog.filename, ForReading);
var r = f.ReadAll();
f.close();
oDiv.innerHTML=r;
sPersistValue=oDiv.innerHTML;
}
oDiv.focus();
}
catch(e){
var sCancel="true";
return sCancel;}
}
function NewDocument(){
var answer = checkForSave();
if (answer) {var sCancel = SaveDocument();
if (sCancel) return;
oDiv.innerHTML="";}
if (answer==false)
oDiv.innerHTML="";
oDiv.focus();
}//This function checks to see if the div has new text, then displays a modal dialog box if appropriate
function checkForSave()
{
if ((oDiv.innerHTML!=sPersistValue)&&(oDiv.innerHTML !=""))
var checkSave=showModalDialog('dcheckForSave.htm','','dialogHeight:125px;dialogWidth:250px;scroll:off');
else
var checkSave=false;
return checkSave;
}//this function is used to call other functions when the user clicks on a menu item. These are the same functions that are called by the toolbar buttons.
function CallMenuFunction(){
var menuChoice = event.result;
switch(menuChoice){
case "open":
LoadDocument();
break;
case "new":
NewDocument();
break;
case "save":
SaveDocument();
break;
case "exit":
window.close();
break;
case "cut":
callFormatting('Cut');
break;
case "copy":
callFormatting('Copy');
break;
case "paste":
callFormatting('Paste');
break;
case "bold":
callFormatting('Bold');
break;
case "underline":
callFormatting('Underline');
break;
case "italic":
callFormatting('Italic');
break;
case "fontColor":
callColorDlg('ForeColor');
break;
case "highlight":
callColorDlg('BackColor');
break;
case "about":
goContext();
break;
default:
break;
}
}//These functions create and display the splash screen and are used when the application is launched (called by onInit function) as well as when the user clicks help/about on the menu
var oPopup = window.createPopup()
function goContext()
{
var oPopupBody = oPopup.document.body; oPopupBody.innerHTML = oContext.innerHTML;
oPopup.show(175, 125, 400, 300, document.body);
document.body.onmousedown = oPopup.hide;
} </script>
</HEAD><BODY STYLE="overflow:hidden; margin:0px" >
<!--Create the Dialog Helper Object-->
<OBJECT id=dlgHelper CLASSID="clsid:3050f819-98b5-11cf-bb82-00aa00bdce0b" WIDTH="0px" HEIGHT="0px" VIEWASTEXT></OBJECT><!-- Create the licensing object for the common dialog activex control -->
<OBJECT CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331" VIEWASTEXT>
<PARAM NAME="LPKPath" VALUE="comdlg.lpk">
</OBJECT><!--Create the Common Dialog Box activex control-->
<OBJECT ID="cDialog" WIDTH="0px" HEIGHT="0px"
CLASSID="CLSID:F9043C85-F6F2-101A-A3C9-08002B2F49FB"
CODEBASE="http://activex.microsoft.com/controls/vb5/comdlg32.cab" VIEWASTEXT>
</OBJECT>
<t:animate dur="5" onend="oPopup.hide();"/>
<DIV ID="oContext" STYLE="display:none">
<DIV STYLE="position:absolute; top:0; left:0; width:400px; height:300px; border:1px solid black; background:#eeeeee; ">
<DIV STYLE="padding:20px; background:white; border-bottom:5px solid #cccccc">
<img src="./Images/htmledlogo.gif" align="absmiddle"></div>
<DIV STYLE="padding:20px; font-size:8pt; line-height:1.5em; font-family:verdana; color:black;">This HTML Editor is created entirely with DHTML technologies and is provided as an example for developers using Internet Explorer 6.0.
<br>
<br>
<br>
<br><center>
©2001 Microsoft Corporation. All rights reserved. </center>
</DIV>
</DIV>
</DIV>