function selectkbn(date)
{   
    
     if(document.Fm_Inputfile.cancel_kbn.value=="する")
 {
 document.Fm_Inputfile.cancel_sw_day.value=date;
 }     if(document.Fm_Inputfile.cancel_kbn.value=="移行")
 {
       document.Fm_Inputfile.cancel_sw_day.value=date;
          }
}调用方法:
selectkbn("2002-05-27")活使用全局变量
var date="2002-05-27"function selectkbn()
{   
    
     if(document.Fm_Inputfile.cancel_kbn.value=="する")
 {
 document.Fm_Inputfile.cancel_sw_day.value=date;
 }     if(document.Fm_Inputfile.cancel_kbn.value=="移行")
 {
       document.Fm_Inputfile.cancel_sw_day.value=date;
          }
}

解决方案 »

  1.   

    我没有表达清楚我的意思.
    我的意思如果date是个变量(xxxx)我如何在selectkbn()外部取得xxxx的值(值为日期型,格式为yy-mm-dd),并传回selectkbn()中!
    function selectkbn()
    {   
        
         if(document.Fm_Inputfile.cancel_kbn.value=="する")
     {
     document.Fm_Inputfile.cancel_sw_day.value=xxxx;
     }     if(document.Fm_Inputfile.cancel_kbn.value=="移行")
     {
           document.Fm_Inputfile.cancel_sw_day.value=xxxx;
              }
    }
      

  2.   

    这样?
    <script>
    function selectkbn()
    {   
        
         if(document.Fm_Inputfile.cancel_kbn.value=="する")
     {
     document.Fm_Inputfile.cancel_sw_day.value=getDate();
     }     if(document.Fm_Inputfile.cancel_kbn.value=="移行")
     {
           document.Fm_Inputfile.cancel_sw_day.value=getDate;
              }
    }function getDate(){
    return showModalDialog("get.html")
    }
    </script>
    get.html中设置window.returnValue=
      

  3.   

    没有明白你的外部指的是哪里。
    在JS有全局变量,写到function外即可。
    比如:
    <script>
    var date = "2002-12-12"
    </script>
    <body>
    .....
    <script>
    function test()
    {
    alert(date)
    }
    </script>