1

我意识到这个帖子已经有很多朋友在这里和其他网站上,但所有帖子似乎都以“你有冲突”结尾。如果我确实有冲突,我看不到它,如果它在那里,可能是由于页面上的 Telerik 及其 RadGrid、RadToaster、RadYoyo 等。但也可能是我只是错过了一些东西。如果我删除 <head> 中的 jQuery 包含项,我会收到“$ 未定义”错误。

这是 <head> 内容,包括 jQuery 包含但不包括 Telerik <link> 标签。任何帮助,将不胜感激。我难住了。

带控件的 HTML:

    <div id="search">
        <form method="get">
            <input name="ctl00$ctl00$ContentPlaceHolder1$ContentPlaceHolder1$q" type="text" id="ContentPlaceHolder1_ContentPlaceHolder1_q" size="35" placeholder="Search..." />
        </form>
    </div>

标题:

<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-40617410-1']);
    _gaq.push(['_trackPageview']);

    (function () {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
</script>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<link rel="stylesheet" href="../Content/smoothness/jquery-ui-1.10.0.custom.min.css" /><link href="../Content/Site.css" rel="stylesheet" type="text/css" /><link href="Parts.css" rel="stylesheet" type="text/css" />


<script language="javascript" type="text/javascript" src="../Scripts/LiveHelp.js"></script>

<script type="text/javascript" src="/Scripts/gridHelpers.js"></script>




    <script type="text/javascript">
        // needs to be present for clearFilter()
        var radGrid;

        $(document).ready(function () {
            $('#ContentPlaceHolder1_ContentPlaceHolder1_q').bind('keypress', function (e) {
                var code = (e.keyCode ? e.keyCode : e.which);
                if (code == 13)
                    DoSearch($('#ContentPlaceHolder1_ContentPlaceHolder1_q').val());
            });

            //$('#orderHistoryButton').bind('click', function () {
            //    DoOrderHistory();
            //});

            $('#ContentPlaceHolder1_ContentPlaceHolder1_favoritesButton').bind('click', function () {
                DoFavorites();
            });

            //$('#mostPopularButton').bind('click', function () {
            //    DoMostPopular();
            //});

            $("#ContentPlaceHolder1_ContentPlaceHolder1_CategoryFilter").change(function () {
                DoCategoryFilter($(this).val());
                //DoCategoryFilter(cat_ddl.val());
            });

            $('#ContentPlaceHolder1_ContentPlaceHolder1_q').autocomplete({ source: ['Lid'] });
            radGrid = $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_RadGrid1");
        });

        function DoSearch(searchText) {
            $("#ContentPlaceHolder1_ContentPlaceHolder1_CategoryFilter").val('');
            $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("Search" + "|" + searchText);
        }

        //function DoOrderHistory() {
        //    $('#ContentPlaceHolder1_ContentPlaceHolder1_q').val('');
        //    $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("OrderHistory");
        //}

        function DoFavorites() {
            $('#ContentPlaceHolder1_ContentPlaceHolder1_q').val('');
            $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("Favorites");
        }

        //function DoMostPopular() {
        //    $('#ContentPlaceHolder1_ContentPlaceHolder1_q').val('');
        //    $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("MostPopular");
        //}

        function DoCategoryFilter(id) {
            $('#ContentPlaceHolder1_ContentPlaceHolder1_q').val('');
            $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("Filter|" + id);
        }

        function AddToCart(partId) {
            var quantity = $('#qty_' + partId).val();
            $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("AddToCart" + "|" + partId + "|" + quantity);
            var currentQuantity = parseInt($find("ContentPlaceHolder1_ContentPlaceHolder1_m_CartItemCountLabel").innerHTML);
            if (!isNaN(currentQuantity)) {
                currentQuantity += quantity;
                $find("ContentPlaceHolder1_ContentPlaceHolder1_m_CartItemCountLabel").innerHTML = currentQuantity;
            }
        }

        function refreshGrid(arg) {
            if (!arg) {
                $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("Rebind");
            }
            else {
                $find("ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder1_m_AjaxManager").ajaxRequest("RebindAndNavigate");
            }
        }

        function ShowDetailView(id) {
            window.radopen("DetailView.aspx?id=" + id, "DetailViewWindow");
            return false;
        }

        function ImagePreview(id) {

        }


    </script>


<style>body { background: transparent url('/images/background4.jpg') no-repeat top center; }</style>

<script type="text/javascript">
    $(document).ready(function () {

        $("td.menu > li").css("color", "red");
        $("li ul li").css("color", "blue")
        $("li ul li").hide();
        $("ul.menu li").hover(

        function () {
            $("ul li", this).show();
        }, function () {
            $("ul li", this).hide();
        }

        );

    });
</script>
<style type="text/css" media="screen">
    body {
        background-size: 100% auto;
    }

    .mymenu
    {    
        margin: 0;
        padding: 0;
    }

    .mymenu li
    {    
        width: 100px;
        margin: 0;
        padding: 0px;
        list-style: none;
        float: left;
    }

    .mymenu li a
    {    
        display: block;
        margin: 0 1px 0 0;
        padding: 4px 0px;
        width: 100px;
        /*background: #bbbaaa;*/
        color: #ffffff;
        text-align: center;
    }

    .mymenu ul a:hover
    {    
        background: #2f2f2f
    }

    .mymenu ul
    {    
        position: absolute;
        visibility: hidden;
        margin: 0 1px 0 0;
        padding: 0;
        /*background: #eeebdd;*/
        /*border: 1px solid #ffffff*/

    }

    .mymenu ul a
    {    
        position: relative;
        display: block;
        margin: 0 1px 0 -30px;
        padding: 5px 10px;
        width: 140px;
        text-align: left;
        background: #000000;
        color: #ffffff;
    }    
</style>
<script type="text/javascript">
    //variables' declaration
    var timer     = 0;
    var item      = 0;

    //function for opening of submenu elements
    function openelement(num)
    {    

        //checks whether there is an open submenu and makes it invisible 
        if(item) item.style.visibility = 'hidden';

        //shows the chosen submenu element
        item = document.getElementById(num);
        item.style.visibility = 'visible';
    }

    // function for closing of submenu elements
    function closeelement()
    {
        //closes the open submenu elements and loads the timer with 500ms
        timer = window.setTimeout("if(item) item.style.visibility = 'hidden';",500);
    }

    //function for keeping the submenu loaded after the end of the 500 ms timer
    function keepsubmenu()
    {
        window.clearTimeout(timer);
    }
    //hides the visualized menu after clicking outside of its area and expiring of the loaded timer
    document.onclick = closeelement; 

</script>
4

1 回答 1

1

当然是冲突!该代码在我错过的 RadScriptManager 中包含 Telerik jQuery。在接管代码时我应该更加细心。

于 2013-09-20T21:03:53.210 回答