日期:2014-05-16  浏览次数:20490 次

高分求助,js history.go(-1)返回问题
问题现象为,点击添加后,条件不符的情况下使用 js history.go(-1)后,这时‘提醒时间’这行为默认值了(须不为默认值),例如选radio‘周’后返回‘周’的选择页面才是我想要的,现在是再次点radio '周' 才可以(submit前的值还在),该如何处理这个情况,各位帮忙啊。(我自己感觉,如果用cookies,返回时用得到的cookies再次执行sd_hide(id),我js不熟)
HTML code


<SCRIPT language=javascript>
function sd_hide(id)
     {
    var sd_endtime = document.getElementById('sd_endtime');
    var y_word = document.getElementById('y_word');
    var m_word = document.getElementById('m_word');
    var d_word = document.getElementById('d_word');
    var sd_week = document.getElementById('sd_week');
    var sd_month = document.getElementById('sd_month');
    var sd_day = document.getElementById('sd_day');
    var sd_number = document.getElementById('sd_number');
    var mg_word = document.getElementById('mg_word');
    
    if(id.value == -1) {
    y_word.innerHTML="";
    m_word.innerHTML="";
    d_word.innerHTML="";
    sd_week.style.display='none';
    sd_day.style.display='none';
    sd_month.style.display='none';
    sd_endtime.style.display='none';
    sd_number.style.display='none';
    mg_word.style.display='none';
     } 
    else if(id.value == 'yyyy') {
    y_word.innerHTML="年:";
    m_word.innerHTML="月";
    d_word.innerHTML="日";
    sd_week.style.display='none';
    sd_day.style.display='';
    sd_month.style.display='';
    sd_endtime.style.display='';
    sd_number.style.display='';
    mg_word.style.display='';
    }
    else if(id.value == 'm') {
    y_word.innerHTML="月:";
    m_word.innerHTML="";
    d_word.innerHTML="日";
    sd_week.style.display='none';
    sd_month.style.display='none';
    sd_day.style.display='';
    sd_endtime.style.display='';
    sd_number.style.display='';
    mg_word.style.display='';
    }
    
    else if(id.value == 'ww') {
    y_word.innerHTML="周:";
    m_word.innerHTML="";
    d_word.innerHTML="";
    sd_month.style.display='none';
    sd_day.style.display='none';
    sd_week.style.display='';
    sd_endtime.style.display='';
    sd_number.style.display='';
    mg_word.style.display='';
    }
                    }
                    
</SCRIPT>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css/css.css">
<title>上海富士达电梯研发有限公司</title>
</head>
<body  topmargin="0" leftmargin="0" onLoad="">
<form method=post name="form1" action="scheduleadd.asp">
  <table border="0" cellpadding="0" cellspacing="0" width="500">
    <tr align="left">
      <td>提醒类型:</td><td>
           <input type="radio"  name="sd_interval" id="-1" value="-1" onclick='sd_hide(this)' >一次性提醒
         <input type="radio"  name="sd_interval" id="ww" value="ww" onclick='sd_hide(this)'>周
         <input type="radio"  name="sd_interval" id="m" value="m"  onclick='sd_hide(this)'>月
         <input type="radio"  name="sd_interval" id="yyyy" value="yyyy" onclick='sd_hide(this)' checked>年
      </td>
        </tr>
    <tr align="left">
      <td>开始使用时间:</td><td width="400">
       <input name="startdate" type="text" class="style2"  onfocus="if (this.value==this.defaultValue) this.value='';" onblur="if (this.value=='') this.value=this.defaultValue;" onclick="new Calendar().show(this);" value="<%=date()%>" siz