开发者

jQuery .load problem

<script type="text/javascript">

    f开发者_开发知识库unction show() {
        var text=$("#text").val();
        $("#output").load("index.htm");
    }

    function send() {
        var text=$("#text").val();

        $.post("new.php",{'txt':text});
        $("#text").val(" ");
    }

</script>

</head>
<body onload="javascript:window.setInterval('show()', 1000)">

<input type="text" id="text">
<div id="output">CHange</div>
<input type="button" value="Send" onclick="send()">

</body>

Now the problem i'm facing is that $("#output").load("index.htm"); doesn't seem to do anything :/ Please Help!


Try to use clean unobtrusive code. body.onload is also a pretty questionable place to execute some code.

$(document).ready(function(){
    show();
});

should do it. I'm not sure why you would call that within an ´interval` ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜