Home > front end >  How to select button by a, and then choose another button assigned to button a?
How to select button by a, and then choose another button assigned to button a?

Time:10-22




<meta charset="utf-8"/& gt;
Sudoku & lt;/title> <br/></head> <br/><style type="text/CSS" & gt; <br/>* {<br/>margin: 0; <br/>padding: 0; <br/>} <br/>Button: hover {<br/>background-color: red; <br/>} <br/># test {<br/>background-color: red; <br/>Width: 156 px; <br/>/* width: 100%; */<br/>} <br/>The geZi {<br/>border: 1px solid red; <br/>float: left; <br/>Width: 50 px; <br/>Height: 50 px; <br/>Background - color: greenyellow; <br/>text-align: center; <br/>line-height: 50px; <br/>} <br/><br/>The input {<br/>The clear: left; <br/>} <br/>. GeZi1 {<br/>border: 1px solid red; <br/>float: left; <br/>Width: 20 px; <br/>Height: 20 px; <br/>Background - color: greenyellow; <br/>text-align: center; <br/>The line - height: 20 px; <br/>} <br/></style> <br/><br/><body> <br/><Div id="test" & gt; <br/><The button id="a0" onclick="jiSuan (this)" & gt; </button> <br/><The button id="a1" onclick="jiSuan (this)" & gt; </button> <br/><The button id="a2" onclick="jiSuan (this)" & gt; </button> <br/><br/><The button id="a3" onclick="jiSuan (this)" & gt; </button> <br/><The button id="a4" onclick="jiSuan (this)" & gt; </button> <br/><The button id="a5" onclick="jiSuan (this)" & gt; </button> <br/><br/><A6 button id="" onclick=" jiSuan (this) "& gt; </button> <br/><A7 button id="" onclick=" jiSuan (this) "& gt; </button> <br/><A8 button id="" onclick=" jiSuan (this) "& gt; </button> <br/></div> <br/><br/><Div & gt; <br/><FuZhi aa0 button id="" onclick=" () "& gt; 1 & lt;/button> <br/><The button id="aa1" onclick="fuZhi ()" & gt; 2 & lt;/button> <br/><The button id="aa2" onclick="fuZhi ()" & gt; 3 & lt;/button> <br/><br/><The button id="aa3" onclick="fuZhi ()" & gt; 4 & lt;/button> <br/><Aa4 button id="" onclick=" fuZhi () "& gt; 5 & lt;/button> <br/><Aa5 button id="" onclick=" fuZhi () "& gt; 6 & lt;/button> <br/></div> <br/><The script type="text/javascript" & gt; <br/>,1,3 var suzi=[[2], [4,6,5], [7,8,9]]. <br/>Var a0=document. GetElementById (' a0); <br/>Var a1=document. GetElementById (" a1 "); <br/>Var a2=document. GetElementById (' a2 '); <br/><br/>Var a3=document. GetElementById (" a3 "); <br/>Var a4=document. GetElementById (" a4 "); <br/>Var a5=document. GetElementById (" a5 "); <br/><br/>Var a6=document. GetElementById (' a6); <br/>Var a7=document. GetElementById (' a7); <br/>Var a8=document. GetElementById (' a8); <br/>A0. InnerHTML=suzi [0] [0]; <br/>A1. InnerHTML=suzi [0] [1]. <br/>A2. InnerHTML=suzi [0] [2]. <br/><br/>A3. InnerHTML=suzi [1] [0]. <br/>A4. InnerHTML=suzi [1] [1]. <br/>A5. InnerHTML=suzi [1] [2]. <br/><br/>A6. InnerHTML=suzi [2] [0]. <br/>A7. InnerHTML=suzi [2] [1]. <br/>A8. InnerHTML=suzi [2] [2]. <br/>Var mm; <br/>The function jiSuan (obj) {<br/>Document. The getElementById (obj. Id). InnerHTML=mm; <br/>} <br/>The function fuZhi (obj) {<br/>Var qq=document. GetElementById (obj. Id); <br/>Alert (qq); <br/>} <br/></script> <br/></body> <br/></html> <br/><img SRC="https://img.codepudding.com/202010/151885220800131.png" Alt=""/><p class="article - content rp"> CodePudding user response: </p>The first three rows by selecting a button a, then select the last row a button assigned to button a,<p class="article - content rp"> CodePudding user response: </p><pre> <br/><! DOCTYPE html> <br/><html> <br/><head> <br/><meta charset="utf-8"/& gt; <br/><title> Sudoku & lt;/title> <br/></head> <br/><style type="text/CSS" & gt; <br/>* {<br/>margin: 0; <br/>padding: 0; <br/>} <br/>Button: hover {<br/>background-color: red; <br/>} <br/># test {<br/>background-color: red; <br/>Width: 156 px; <br/>/* width: 100%; */<br/>} <br/>The geZi {<br/>border: 1px solid red; <br/>float: left; <br/>Width: 50 px; <br/>Height: 50 px; <br/>Background - color: greenyellow; <br/>text-align: center; <br/>line-height: 50px; <br/>} <br/><br/>The input {<br/>The clear: left; <br/>} <br/>. GeZi1 {<br/>border: 1px solid red; <br/>float: left; <br/>Width: 20 px; <br/>Height: 20 px; <br/>Background - color: greenyellow; <br/>text-align: center; <br/>The line - height: 20 px; <br/>} <br/></style> <br/><br/><body> <br/><Div id="test" & gt; <br/><The button id="a0" onclick="jiSuan (this)" & gt; </button> <br/><The button id="a1" onclick="jiSuan (this)" & gt; </button> <br/><The button id="a2" onclick="jiSuan (this)" & gt; </button> <br/><br/><The button id="a3" onclick="jiSuan (this)" & gt; </button> <br/><The button id="a4" onclick="jiSuan (this)" & gt; </button> <br/><The button id="a5" onclick="jiSuan (this)" & gt; </button> <br/><br/><A6 button id="" onclick=" jiSuan (this) "& gt; </button> <br/><A7 button id="" onclick=" jiSuan (this) "& gt; </button> <br/><A8 button id="" onclick=" jiSuan (this) "& gt; </button> <br/></div> <br/><br/><Div & gt; <br/><Aa0 button id="" onclick=" fuZhi (this) "& gt; 1 & lt;/button> <br/><The button id="aa1" onclick="fuZhi (this)" & gt; 2 & lt;/button> <br/><The button id="aa2" onclick="fuZhi (this)" & gt; 3 & lt;/button> <br/><br/><The button id="aa3" onclick="fuZhi (this)" & gt; 4 & lt;/button> <br/><nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull </div> <div class="th_page th_page_color"></div> <div class="umCopyright"> <p>Page link:<a href="/frontend/70603.html" target="_blank" style="color:#999">https//www.codepudding.com/frontend/70603.html</a></p> </div> <div class="detail-arr"> <div class="detail-arr-left">Prev:<a href='/frontend/70602.html'>Python web development</a></div> <div class="detail-arr-right">Next:<a href='/frontend/70604.html'>Fiddler after installation is not available</a></div> </div> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="hot-tags neitags"> <ul> <li><i class="iconfont icon-x-tags"></i> Tags:  </li> <a href='/e/tags/?tagname=JavaScript' target='_blank'>JavaScript</a> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="xiangguan"> <ul class="msg msghead"> <li class="tbname">Related</li> </ul> <ul> </ul> </div> </div> </div> </div> <div class="container th_top"> <div class="row"> <div class="col-md-12"> <div class="flinks"> <ul> <li><i class="iconfont icon-x-tags"></i> Links:  </li> <li class="liflinks"><a target="_blank" href="/" title="CodePudding">CodePudding</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <p><span style="font-size:16px;color:#666;font-weight: bold">About Us:</span>  <a href="https://www.codepudding.com/contact.html">Contact Us</a>      <a href="https://www.codepudding.com/service.html">Terms of Service</a>      <a href="https://www.codepudding.com/privacy.html"> Privacy Policy</a></p> <p class="foot_info">Copyright © 2010-2023,Powered By <a href="/" target="_blank">CodePudding</a> </p> </div> <script type="text/javascript" src="/skin/code/tianhu.js"></script> </body></html>