내가 masterpagecode, 모든 어린이 페이지 내 자바 스크립트를 실행하려고 :모든 하위 페이지에서 js를 실행하는 방법은 무엇입니까?
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs" Inherits="WindowonUnload.Site1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
<script>
//window.addEventListener('unload', function() { alert('hahaha'); });
window.onunload = function() {
alert('from webf master');
}
</script>
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
childpage : 내가 잘못
<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="WindowonUnload.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
</asp:Content>
을 뭐하는 거지?
시도를 당신의 자바 스크립트 코드를 넣습니다. –