不显示图像下方文本的javascript选择

不显示图像下方文本的javascript选择,javascript,Javascript,我对一些代码和旧js有问题。我复制了网页并更改了代码,但在新文件中选择相应的缩略图时,文本不会出现在大图像下: 函数交换图像(imgID) { var itemImage=document.getElementById('itemImage'); var itemText=document.getElementById('itemText'); var itemCaption=document.getElementById('itemCaption'); itemage.src=“图像/修饰/

我对一些代码和旧js有问题。我复制了网页并更改了代码,但在新文件中选择相应的缩略图时,文本不会出现在大图像下:


函数交换图像(imgID)
{
var itemImage=document.getElementById('itemImage');
var itemText=document.getElementById('itemText');
var itemCaption=document.getElementById('itemCaption');
itemage.src=“图像/修饰/着色/纹理化/纹理化”+imgID+“\u sm.jpg”;
如果(imgID==1)
{
itemText.innerHTML='纬度东';
itemCaption.innerHTML='''};
如果(imgID==2)
{
itemText.innerHTML='Summer Breeze';
itemCaption.innerHTML='''};
如果(imgID==3)
{
itemText.innerHTML='wintercherry';
itemCaption.innerHTML='''};
如果(imgID==4)
{
itemText.innerHTML=‘秋叶’;
itemCaption.innerHTML='''};
如果(imgID==5)
{
itemText.innerHTML='Boardwalk';
itemCaption.innerHTML='''};
如果(imgID==6)
{
itemText.innerHTML='Driftwood';
itemCaption.innerHTML='''};
如果(imgID==7)
{
itemText.innerHTML='Canvas Linen';
itemCaption.innerHTML='''};
如果(imgID==8)
{
itemText.innerHTML='亚麻亚麻籽';
itemCaption.innerHTML='''};
如果(imgID==9)
{
itemText.innerHTML='银色法兰绒';
itemCaption.innerHTML='''};
如果(imgID==10)
{
itemText.innerHTML='Onyx';
itemCaption.innerHTML='''};
如果(imgID==11)
{
itemText.innerHTML='东印度月桂';
itemCaption.innerHTML='''};
如果(imgID==12)
{
itemText.innerHTML='檀香木';
itemCaption.innerHTML='''};
如果(imgID==13)
{
itemText.innerHTML='Nora Creek Oak';
itemCaption.innerHTML='''};
如果(imgID==14)
{
itemText.innerHTML='Midnight Espresso';
itemCaption.innerHTML='''};
}
颜色及;污点
纹理颜色

第1页,共3页

请注意:我们的图库中的项目被选中以显示 我们的产品。如果你看不清楚你的想法,很可能我们已经知道了 或者我可以帮你点。

&拉阔
&拉阔
&拉阔;


选择缩略图时,我需要在大图像下方显示文本,如本页所示:

您缺少在html中显示文本的元素。因为它不存在,所以尝试添加文本没有任何作用。使用class=“imgContainer2”将其添加到您的div中

                            <script type="text/javascript">
    function swapImage(imgID)
    {
        var itemImage   = document.getElementById('itemImage');
        var itemText    = document.getElementById('itemText');
        var itemCaption = document.getElementById('itemCaption');

        itemImage.src =              "images/finishing_touches/color_stain/textured/textured" + imgID + "_sm.jpg";

            if(imgID == 1)
            {
                itemText.innerHTML    = 'Latitude East';
                itemCaption.innerHTML = ''};

            if(imgID == 2)
            {
                itemText.innerHTML    = 'Summer Breeze';
                itemCaption.innerHTML = ''};

            if(imgID == 3)
            {
                itemText.innerHTML    = 'Winter Cherry';
                itemCaption.innerHTML = ''};

            if(imgID == 4)
            {
                itemText.innerHTML    = 'Autumn Leaves';
                itemCaption.innerHTML = ''};

            if(imgID == 5)
            {
                itemText.innerHTML    = 'Boardwalk';
                itemCaption.innerHTML = ''};

            if(imgID == 6)
            {
                itemText.innerHTML    = 'Driftwood';
                itemCaption.innerHTML = ''};

            if(imgID == 7)
            {
                itemText.innerHTML    = 'Canvas Linen';
                itemCaption.innerHTML = ''};

            if(imgID == 8)
            {
                itemText.innerHTML    = 'Linen Flaxseed';
                itemCaption.innerHTML = ''};

            if(imgID == 9)
            {
                itemText.innerHTML    = 'Silver Flannel';
                itemCaption.innerHTML = ''};

            if(imgID == 10)
            {
                itemText.innerHTML    = 'Onyx';
                itemCaption.innerHTML = ''};

                            if(imgID == 11)
            {
                itemText.innerHTML    = 'East Indian Laurel';
                itemCaption.innerHTML = ''};

                              if(imgID == 12)
            {
                itemText.innerHTML    = 'Sandalwood';
                itemCaption.innerHTML = ''};

                              if(imgID == 13)
            {
                itemText.innerHTML    = 'Nora Creek Oak';
                itemCaption.innerHTML = ''};

                                 if(imgID == 14)
            {
                itemText.innerHTML    = 'Midnight Espresso';
                itemCaption.innerHTML = ''};
                    }
    </script>
                            <h1 class="galleryTitle">Color &amp; Stain</h1>
                            <div class="subMenu">
                            <ul>
                                <li><a href="color_stain1.htm">solid color melamine</a> </li>
                                <li><a href="color_stain3.htm">wood tone melamine</a></li>
                                <li><a class="active" href="color_stain_textured_1.htm">textured melamine</a></li>
                                <li><a href="color_stain.htm">wood veneer</a></li>
                            </ul>
                            </div>
                            <div class="galleryContainer2">
                            <div class="galleryNavContainer2">
                            <div class="subtitle">
                            <p>Textured Color</p>
                            </div>
                            <div class="thumbs">
                            <div class="pageDetail1">
                            <p>page 1 of 3</p>
                            </div>
                            <div class="img">
                            <a href="javascript:swapImage(&quot;1&quot;)">
                            <img src="images/finishing_touches/color_stain/textured/textured1_th.jpg" alt="Latitude East" title="Latitude East" />
                            <span class="imgText">Latitude East</span>
                            </a>
                            </div>
                            <div class="img">
                            <a href="javascript:swapImage(&quot;11&quot;)">
                            <img src="images/finishing_touches/color_stain/textured/textured11_th.jpg" alt="Summer Breeze" title="East Indian Laurel" />
                            <span class="imgText">East Indian Laurel</span>
                            </a>
                            </div>
                            <div class="img">
                            <a href="javascript:swapImage(&quot;12&quot;)">
                            <img src="images/finishing_touches/color_stain/textured/textured12_th.jpg" alt="Sandalwood" title="Sandalwood" />
                            <span class="imgText">Sandalwood</span>
                            </a>
                            </div>
                            <div class="img">
                            <a href="javascript:swapImage(&quot;13&quot;)">
                            <img src="images/finishing_touches/color_stain/textured/textured13_th.jpg" alt="Nora Creek Oak" title="Nora Creek Oak" />
                            <span class="imgText">Nora Creek Oak</span>
                            </a>
                            </div>
                            <div class="img">
                            <a href="javascript:swapImage(&quot;14&quot;)">
                            <img src="images/finishing_touches/color_stain/textured/textured14_th.jpg" alt="Midnight Espresso" title="Midnight Espresso" />
                            <span class="imgText">Midnight Espresso</span>
                            </a>
                            </div>
                            </div>
                            <div class="page">
                            <ul style="margin: 0px auto; padding: 0px; text-align: center;">
                                <li class="previous"></li>
                                <li class="next"><a href="color_stain_textured.htm">page</a>
                                </li>
                            </ul>
                            </div>
                            </div>
                            <div class="imgContainer2">
                            <div class="img"><img alt="" id="itemImage" name="IMG1" /></div>
                            <div class="text" style="margin-top: 13px; padding: 2px 0px 0px;">
                            </div>
                            </div>
                            </div>
                            <script type="text/javascript">
<!--
    var imgID = "1";
    swapImage(imgID);
//-->
                            </script>
                            </div>
                            <p style="margin-right: 15px;">
                            <strong>PLEASE NOTE</strong>: Items in our gallery are selected to show the variety of
                            our products. If you don't see exactly what you have in mind, most likely we have it
                            or can order it for you.
                            </p>
                            <div style="float: right; text-align: right;">
                            <p>
                            <a href="index.htm">View our other galleries</a> &raquo;<br />
                            <a href="http://www.marketingresponse.com/closetos/contact.asp">Schedule a complimentary in-home design consultation</a> &raquo;<br />
                            <a href="../locations.htm">Visit our Chicago area showrooms</a> &raquo;
                            </p>
                            </div>
                            <script language="JavaScript"><!--
     ThisPage = Gallery;
     GroupChange("on",ThisPage);
    //-->
                            </script>
<p id="itemText" style="padding-bottom: 0px;"></p>