RT, 我的页面里有表头表体 当用户选择进入表体时要先判断 表头的内容是不是已经 保存.下面是我的把页面分成表头表体的代码
<script language="javascript">function enterJob(id){
if(id==0){
if(document.getElementById("b").style.display=="block")
{
document.getElementById("b").style.display="none";
}
if(document.getElementById("b").style.display=="none")
{
document.getElementById("a").style.display="block";
}
}
if(id==1){
if(document.getElementById("a").style.display=="block")
{
document.getElementById("a").style.display="none";
}
if(document.getElementById("a").style.display=="none")
{
document.getElementById("b").style.display="block";
}
}
}
</ script ><body><table width="25%" cellspacing="0" cellpadding="0" class=httable01>
<tr>
<td height="20" width="40" align="center"
onmouseover="this.style.cursor='hand'"
style="padding-right:0px;width:100px;background-image:url('<c:url value='/images/bom1.jpg'/>'); background-repeat: no-repeat; background-position: right center">
<span onclick="enterJob(0)"><font
style="font-size:13px;font-family:黑体">作业单表头</font> </span>
</td>
<td height="20" width="40" align="center"
onmouseover="this.style.cursor='hand'"
style="padding-right:0px;width:100px;background-image:url('<c:url value='/images/bom1.jpg'/>'); background-repeat: no-repeat; background-position: right center">
<span onclick="enterJob(1)"><font
style="font-size:13px;font-family:黑体">作业单表体</font> </span>
</td>
</tr>
</table>
</body>
<script language="javascript">function enterJob(id){
if(id==0){
if(document.getElementById("b").style.display=="block")
{
document.getElementById("b").style.display="none";
}
if(document.getElementById("b").style.display=="none")
{
document.getElementById("a").style.display="block";
}
}
if(id==1){
if(document.getElementById("a").style.display=="block")
{
document.getElementById("a").style.display="none";
}
if(document.getElementById("a").style.display=="none")
{
document.getElementById("b").style.display="block";
}
}
}
</ script ><body><table width="25%" cellspacing="0" cellpadding="0" class=httable01>
<tr>
<td height="20" width="40" align="center"
onmouseover="this.style.cursor='hand'"
style="padding-right:0px;width:100px;background-image:url('<c:url value='/images/bom1.jpg'/>'); background-repeat: no-repeat; background-position: right center">
<span onclick="enterJob(0)"><font
style="font-size:13px;font-family:黑体">作业单表头</font> </span>
</td>
<td height="20" width="40" align="center"
onmouseover="this.style.cursor='hand'"
style="padding-right:0px;width:100px;background-image:url('<c:url value='/images/bom1.jpg'/>'); background-repeat: no-repeat; background-position: right center">
<span onclick="enterJob(1)"><font
style="font-size:13px;font-family:黑体">作业单表体</font> </span>
</td>
</tr>
</table>
</body>
解决方案 »
- IE6 'sinaFlash' 未定义
- 发一个“万恶”的复制代码,贡献给有站的朋友
- 请教一个正则小问题
- 百分求一个判断分辨率问题的代码
- $(document).scrollLeft和document.documentElement.scrollLeft的区别
- netscape vs IE
- 求asp写的qq
- 大家来说说这几个方法的用法。比如obj.getAdjacentText
- 救急!怎样实现点击一个链接,在此页面上出些一个层?并能让此层从左边惭惭出现?
- 求web版本画流程图工具(需要能部署到本地)
- 正则匹配(URL重新)
- window.functionName = new Function() 有什么特别吗?
function save()
{
var myform = document.getElementById("InspectionWorkForm");
if(myform != null && document.getElementById("checkNo").value!=""){
var r = confirm("确认保存吗");
if(r){
uri = "../InspectionWork.do?method=save"
}else{
return false;
}
uri=encodeURI(uri);
myform.action=uri;
myform.submit();
var bj =document.getElementById("checkNo")
}
} 在保存里做标记的话该怎么办??
if(r){
uri = "../InspectionWork.do?method=save"
//保存后改变状态
}
<script language="javascript">
var all=0;------------------------------------------------------
保存时赋予全局变量一个新值
function save()
{
var myform = document.getElementById("InspectionWorkForm");
if(myform != null && document.getElementById("checkNo").value!=""){
var r = confirm("确认保存吗");
if(r){
uri = "../InspectionWork.do?method=save"
//给全局变量一个新值 all++;
}else{
return false;
}
uri=encodeURI(uri);
myform.action=uri;
myform.submit(); }
}
------------------------------------------------------------
当进去表体时 判断all的值 如果是0弹出提示,1就正常进入function enterJob(id){
//进入表头
if(id==0){
if(document.getElementById("b").style.display=="block")
{
document.getElementById("b").style.display="none";
}
if(document.getElementById("b").style.display=="none")
{
document.getElementById("a").style.display="block";
}
}
//进入表体
if(id==1){
//判断all的值 1进去,0弹出提示
if(all=0)
{
alert("请先保存表头");
return false;
}else (all=1)
{
if(document.getElementById("a").style.display=="block")
{
document.getElementById("a").style.display="none";
}
if(document.getElementById("a").style.display=="none")
{
document.getElementById("b").style.display="block";
}
}
}
}
我这个写的可是没效果啊~~~~~我是不是哪里写错了???
改成if(all == 0)