在页面上单击按钮(图像)并显示文本。当文本出现时,您单击该文本,我希望它出现在输入框中。例如,您点击图片 red.jpg,旁边会出现“水果香味”的文字。当您单击“水果香味”时,我希望它出现在输入框中。我希望这从框 1 到框 3 的顺序发生,如果第一个框已满,则进入第二个框。我不太擅长使用数组,所以我不知道从哪里开始。这是我拥有的所有代码:
<script>
var current_obj='';
function showLinks(objID) {
var obj=document.getElementById(objID); if (current_obj.style) {
current_obj.style.display='none'; }
obj.style.display='block';
current_obj=obj; }
</script>
<style type="text/css" media="all">
.showhide_element {
display: none; }
html {
background-repeat:no-repeat;
background-size:100% 100%;
height: 100%;
}
#container{width:1950px;}
#container div{float:left;width:300px;margin-left:10px;margin-right:10px}
div#Contact {
background: #FFF;
margin-left: auto;
margin-right: auto;
padding: 50px;
width: 1000px;
height:800px;
border-radius:25px;
-moz-border-radius:25px;
}
div#Contact_Text {
background: yellow;
}
div.Contact_Button {
background: white;
height: 500px;
margin-top: 100px;
width: 96px;
border:2px dotted;
border-radius:25px;
-moz-border-radius:25px;
}
div.test {
align:right;
}
#container #Contact .Contact_Button {
color: #909090;
}
#FruitsMenu_info {
width:96px;
height:500px;
}
#FloralsMenu_info {
width:96px;
height:500px;
}
div.Contact_Button2{
background: white;
height: 500px;
margin-top: 100px;
width: 96px;
border:2px dotted;
border-radius:25px;
-moz-border-radius:25px;
}
div.Contact_Button3{
background: white;
height: 500px;
margin-top: 100px;
width: 96px;
border:2px dotted;
border-radius:25px;
-moz-border-radius:25px;
}
</style>
</head>
<body bgcolor="#ade0fa">
<div id="container">
<div style="position: absolute; z-index: 5000; top: 24px; left: 22px;"><img
src="customize.jpg" width="288" height="100" /></div>
<div id="Contact">
<div class="Contact_Button">
<p align="center"><b> <font color:"#a6a6a6">Select a Scent Category</font></b></p>
<a href="#" onClick="showLinks('FruitsMenu_info');return false;"><div
style="position:
absolute;width:134px; z-index: 5000; top: 200px; left: 120px;"><img src="red.jpg"
width="132" height="43" /> </div></a>
<a href="#" onClick="showLinks('FloralsMenu_info');return false;"><div
style="position:
absolute;width:134px; z-index: 5000; top: 240px; left: 120px;"><img src="Florals.jpg"
width="132" height="43" /></div></a>
</div>
<div class="Contact_Button2">
<p align="center"><b> <font color:"#a6a6a6F">Choose 3 Scents </font></b></p>
<div style="z-index: 5000; top: 540px; left: 220px;"id="FruitsMenu_info"
class="showhide_element">
<p align="center"><font color:"#000000">Fruits Scents</font></p></div>
<div style="z-index: 5000; top: 540px; left: 220px;"id="FloralsMenu_info"
class="showhide_element"><p align="center"><font color:"#000000">Floral Scents</font>
</p></div>
</div>
<div class="Contact_Button3">
<p align="center"><b> <font color:"#a6a6a6">Your Blend</font></b></p>
<form id="form1" name="form1" method="post" action="">
<input type="text" name="Scent 1" id="Scent 1" />
<label for="Scent 1"></label>
Scent 1
<input name="Scent 2" type="text" />
Scent 2
<input name="Scent 3" type="text" />
Scnet 3
</form>
</div>
</div>
</div>
</body>
</html>