ascx页面无法重新排列jquery或javascript [英] ascx page not recogonising jquery or javascript

查看:67
本文介绍了ascx页面无法重新排列jquery或javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在ascx Web控件上运行一个简单的jquery函数,如下所示.当页面运行时,不会显示警报.我正在使用VS2010 SP1.谁能帮忙

I am trying to run a simple jquery function on an ascx web control, shown below. when the page runs the alert is not displayed . I am using VS2010 SP1. Can any one help

<%@ Control Language="vb" AutoEventWireup="false" CodeFile="inc_header.ascx.vb" Inherits="inc_header" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>

<script type="text/javascript" src="scripts/jquery-1.6.3.js">
    $(document).ready (function () {
        alert('test');

    });

</script>

推荐答案

(文档) .ready(功能(){ alert(' test'); }); < / 脚本 >
(document).ready (function () { alert('test'); }); </script>



(文档).ready( function (){});
(document).ready(function () {});

仅在发生完全回发之后(重新加载DOM时)才能运行.我假设您正在通过另一种AJAX方法添加控件(在这种情况下,document.ready将不会触发.您可以使用AJAX框架事件pageLoad(sender,args),该事件将在回调和回发之后触发.所以..

will only run after a full postback occurs (when the DOM is reloaded). I assume you are adding the controls via another AJAX method (in that case document.ready will not fire. You can use the AJAX framework event pageLoad(sender, args) which will fire after both a callback and postback. You can use it like so ..

function pageLoad(sender, args) {
        if (args.get_isPartialLoad()) {
            setAutoTimer();
            getData();
        }
    }


这篇关于ascx页面无法重新排列jquery或javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆