File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 99< body >
1010 < div class ="container ">
1111 < img id ="mainImage " src ="images/heart.png " alt ="爱心 ">
12- < h1 id ="question "> 可以成为我的恋人吗 ?</ h1 >
12+ < h1 id ="question "> < a id =" egg " > 可以 </ a > 成为我的恋人吗 ?</ h1 >
1313 < div class ="buttons ">
1414 < button id ="yes "> 可以</ button >
1515 < button id ="no "> 不要</ button >
@@ -18,4 +18,4 @@ <h1 id="question">可以成为我的恋人吗?</h1>
1818
1919 < script src ="script.js "> </ script >
2020</ body >
21- </ html >
21+ </ html >
Original file line number Diff line number Diff line change 11let yesButton = document . getElementById ( "yes" ) ;
22let noButton = document . getElementById ( "no" ) ;
3+ let eggButton = document . getElementById ( "egg" ) ;
34let questionText = document . getElementById ( "question" ) ;
45let mainImage = document . getElementById ( "mainImage" ) ;
56
@@ -61,7 +62,7 @@ const loveTest = `!!!喜欢你!! ( >᎑<)♡︎ᐝ ${
6162 username ? `${ safeUsername } ♡︎ᐝ(>᎑< )` : ""
6263} `;
6364
64- yesButton . addEventListener ( "click" , function ( ) {
65+ function ok ( ) {
6566 // 先创建基础 HTML 结构
6667 document . body . innerHTML = `
6768 <div class="yes-screen">
@@ -75,4 +76,7 @@ yesButton.addEventListener("click", function () {
7576
7677 // 禁止滚动,保持页面美观
7778 document . body . style . overflow = "hidden" ;
78- } ) ;
79+ } ;
80+
81+ yesButton . addEventListener ( "click" , ok ) ;
82+ eggButton . addEventListener ( "click" , ok ) ;
You can’t perform that action at this time.
0 commit comments