javascript代码每当我添加母版页它不工作 [英] javascript code whenever i add the master page it is not working

查看:92
本文介绍了javascript代码每当我添加母版页它不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js" />
    <script type="text/javascript" language="javascript">
        function buttonclick() {
            document.getElementById('Button2').click();
        }
    </script>

    <script type="text/javascript" language="javascript">

        $(document).ready(function() {
            $("#Button2").click(function() {
                autoComp();
            });
            $(function autoComp() {
                //  alert('hello');
                var textb = document.getElementById('TextBox1').value;

                if ((textb != null) && (textb != "")) {
                    if (parseInt(textb) == 0) {
                        $("#image1").fadeTo("fast", 0.15);
                        $("#image2").fadeTo("fast", 0.15);
                        $("#image3").fadeTo("fast", 0.15);
                        $("#image4").fadeTo("fast", 0.15);
                        $("#image4").fadeTo("fast", 0);
                    }

                    if (parseInt(textb) == 25) {

                        $("#image1").fadeTo("fast", 0.25);
                        $("#image2").fadeTo("fast", 0.25);
                        $("#image3").fadeTo("fast", 0.25);
                        $("#image4").fadeTo("fast", 0.25);
                    }
                    if (parseInt(textb) == 50) {
                        $("#image1").fadeTo("fast", 0.5);
                        $("#image2").fadeTo("fast", 0.5);
                        $("#image3").fadeTo("fast", 0.5);
                        $("#image4").fadeTo("fast", 0.5);
                    }
                    if (parseInt(textb) == 75) {
                        $("#image1").fadeTo("fast", 0.75);
                        $("#image2").fadeTo("fast", 0.75);
                        $("#image3").fadeTo("fast", 0.75);
                        $("#image4").fadeTo("fast", 0.75);

                    }
                    if (parseInt(textb) == 100) {
                        $("#image1").fadeTo("fast", 1);
                        $("#image2").fadeTo("fast", 1);
                        $("#image3").fadeTo("fast", 1);
                        $("#image4").fadeTo("fast", 1);
                    }
                }
            });
        });    
    </script>




<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
<div id="div1" style="background-color: #000000"  runat="server">
<asp:Image ID="image1" runat="server" AlternateText="Ledbulb" ImageUrl="Images/Transparent_Bulb.png" />
    ;<asp:Image ID="image2" runat="server" AlternateText="Ledbulb" ImageUrl="Images/Transparent_Bulb.png" />

<asp:Image ID="image3" runat="server" AlternateText="Ledbulb" ImageUrl="Images/Transparent_Bulb.png" />

<asp:Image ID="image4" runat="server" AlternateText="Ledbulb" ImageUrl="Images/Transparent_Bulb.png" />
    <br />
    <asp:Image ID="Image5" runat="server" Width="100%" ImageUrl="~/Images/Road.PNG" />
    <br />

    <asp:Label ID="Label1" runat="server" Text="PoleID : P1" ForeColor="White" Font-Bold="True"></asp:Label>

    <br />
    <asp:Label ID="Label5" runat="server" Font-Bold="True" ForeColor="White"

        Text="DutyCapaciy :"></asp:Label>
<asp:Label ID="lblDC1" runat="server" ForeColor="White" >NULL</asp:Label>

</div><br>
<asp:Button ID="Button2" runat="server" Text="Display"/>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="Server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="1" >
<ProgressTemplate>Update in Progress……..  </ProgressTemplate>
</asp:UpdateProgress>



上面的代码是在单个页面中工作正常,但每当我添加母版页时,它都无法帮助我从


The above code it is working in individual page fine but whenever i add the master page it is not working help me from this

推荐答案

document ).ready( function (){
(document).ready(function() {


#Button2)。click( function (){
autoComp();
});
("#Button2").click(function() { autoComp(); });


function autoComp(){
// alert('hello');
var textb = document .getElementById(' TextBox1') .value;

if ((textb!= null )&& ;(textb!= )){
if parseInt (textb)== 0 ){
(function autoComp() { // alert('hello'); var textb = document.getElementById('TextBox1').value; if ((textb != null) && (textb != "")) { if (parseInt(textb) == 0) {


这篇关于javascript代码每当我添加母版页它不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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