在javascript函数中调用html页面

时间:2014-02-09 01:34:11

标签: javascript jquery html

我正在尝试使用javascript制作日历..我正在尝试比单击数据打开另一个html页面...我到目前为止所做的是当我点击日期时它会给我一个警告消息...我希望在我的函数中打开一个html页面而不是警告消息...那么如何在我的函数中打开calendar2.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>

1 个答案:

答案 0 :(得分:0)

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

https://api.jquery.com/load/