2014-02-09 72 views
1

我想用javascript做一個日曆..我試圖比點擊數據打開另一個html頁面...我現在做的事情是,當我點擊它給了我一個警告消息的日期...我想要的,而不是警告消息,在我的函數打開一個html頁面...所以,我怎麼能打開calendar2.html我下面的函數中:調用一個javascript函數內的html頁面

g_globalObject.setOnSelectedDelegate(function(){ 
      var obj = g_globalObject.getSelectedDay(); 
      alert("a date was just selected and the date is : " + obj.day + "/" + obj.month + "/" + obj.year); 
      document.getElementById("div3_example_result").innerHTML = obj.day + "/" + obj.month + "/" + obj.year; 
     }); 

放什麼而不是:

`alert("a date was just selected and the date is : " + obj.day + "/" + obj.month + "/" + obj.year);` 

在此先感謝幫助我!

我把行像下面,但它不起作用......如果把它:

<script type="text/javascript"> 
    window.onload = function(){ 


     g_globalObject = new JsDatePick({ 
      useMode:1, 
      isStripped:true, 
      target:"div3_example" 

     });  

     $('#div3_example_result').load('index.html'); 

     g_globalObject.setOnSelectedDelegate(function(){ 
      var obj = g_globalObject.getSelectedDay(); 
      alert("a date was just selected and the date is : " + obj.day + "/"   + obj.month + "/" + obj.year); 

      document.getElementById("div3_example_result").innerHTML = obj.day + "/" + obj.month + "/" + obj.year; 
     }); 

     }; 

</script> 
</head> 
<body> 


    <div id="div3_example" style="margin:10px 0 30px 0; border:dashed 1px red; width:205px; height:230px;"> 

    </div>     

    <div id="div3_example_result" style="height:20px; line-height:20px; margin:10px 0 0 0; border:dashed 1px #666;"></div> 

</body> 
</html> 

回答

相關問題