누군가 나를 도울 수 있습니까?Javascript가 Asp에서 작동하지 않습니다. NET
내 js가 작동하지 않아 div를 숨기고 te 버튼을 클릭하면 divId가 나타나야하지만 아무 일도 일어나지 않습니다! 나는 아래 코드를 보내고있다. 마스터 페이지 파일에 무엇이 잘못 되었습니까?
%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AppTest.aspx.cs" Inherits="AppTest.Screens.UploadFile" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<style>
.hidden{
display: none;
}
</style>
<div class="row">
<h2>File Upload</h2>
<br />
<asp:Panel ID="panelUpload" runat="server">
<p> <asp:Label ID="lblFileUpload" Width="300px" runat="server">Select the file:</asp:Label>
<asp:FileUpload ID="fileUP" runat="server" /></p>
<p>
<asp:Label ID="lblDdl" runat="server">Paciente</asp:Label>
<asp:DropDownList ID="ddl1" runat="server">
</asp:DropDownList>
</p>
<br />
</asp:Panel>
<div id="divId" class="hidden">
</br>
<h2>Cadastro de paciente</h2>
<br />
<p>
<asp:Label ID="lblName" runat="server">Name:</asp:Label>
<asp:TextBox ID="txtName" runat="server" Width="140px"></asp:TextBox>
</p>
<p>
<asp:Label ID="lblLast" runat="server">Last Name:</asp:Label>
<asp:TextBox ID="txtLastName" runat="server" Width="140px"></asp:TextBox>
</p>
<p>
<asp:Label ID="lblAge" runat="server">Age:</asp:Label>
<asp:TextBox ID="txtAge" runat="server" Width="140px"></asp:TextBox>
</p>
<br />
</div>
<p>
<div class="col-md-6">
<asp:Button ID="btnInsert" runat="server" Text="Inserir"/>
</div>
<div class="col-md-6">
<button>New</button>
</div>
</p>
</div>
</asp:Content>
<asp:Content ContentPlaceHolderID="ScriptPlaceHolder1" ID="scripts" runat="server">
<script src="../Scripts/jquery-1.10.2.js" ></script>
<script>
$(document).ready(function() {
$('button').on('click', function() {
$('#divId').show(); // aparece o div
});
});
</script>
</asp:Content>
파이어 폭스를 사용하는 경우 firebug를 사용하면 cosole에서 오류가 발생합니다 –
show on class –
스크립트 태그 "text/javascript"에 유형 속성을 추가하여 시작할 수 있습니다 – Lidaranis