gpt4 book ai didi

JavaScript 目标。

转载 作者:行者123 更新时间:2023-11-28 04:57:28 32 4
gpt4 key购买 nike

这是有问题的网站:

http://www.onepixelroom.com/londonrefurb

当我点击关于部分后面的多个圆圈时,我希望它更改上面文本中的引号。

到目前为止,我得到它来显示

  • 文本中的内容。但我真的希望它能为每个按钮显示一个特定的引用。

    例如,当我点击“one”时,我希望它说:“Gloubiboulga”但是当我点击“两个”时,我希望它说:“Zorro”

    JavaScript:

    <body onLoad="initialize();">
    <script type="text/javascript">window.onload=function(){
    var ul = document.querySelector('#bodyleft ul');
    ul.onclick = function(e){
    var evt = e || window.event;
    var target = evt.target || evt.srcElement;
    var p = document.querySelector('#bodyright h3');
    p.innerHTML = '" ' + target.innerHTML + ' "';
    return false;
    };
    }</script>

    html:

    <div id="bodyright">
    <h3>" one "</h3>
    </div>



    <div id="bodyleft">
    <ul class="benefitSwitcher">
    <li><a href="#_self" style="cursor: pointer; ">one</a></li>
    <li><a href="#_self" style="cursor: pointer; ">two</a></li>
    <li><a href="#_self" style="cursor: pointer; ">three</a></li>
    <li class="last"><a href="#_self" style="cursor: pointer; ">four</a></li>
    </ul>
    </div>

    </div>

    CSS:

    .benefitSwitcher {
    top:120px;
    position:relative;
    display: block;
    width: 695px;
    list-style: none;
    text-align: center;
    margin: 0;
    padding: 0;
    margin: auto;
    z-index:2;

    }

    .benefitSwitcher li {
    display: table;
    float: left;
    margin-right: 70px;
    z-index: 2;

    }

    .benefitSwitcher li.last { margin-right: 0; z-index:2;}

    .circleLink { display: table; margin: auto; margin-top: 40px; z-index:2;}

    .benefitSwitcher li a, .circleLink a {
    display: table-cell;
    width: 90px;
    height: 120px;
    padding: 0 15px;
    background-color: #fff;
    color: #414141;
    text-decoration:none;
    border-radius: 60px;
    font-family: Georgia, sans-serif;
    font-style: italic;
    line-height: 1.2;
    vertical-align: middle;
    -webkit-transition-property: background-color, color;
    -moz-transition-property: background-color, color;
    -o-transition-property: background-color, color;
    transition-property: background-color, color;
    -webkit-transition-duration: 0.2s;
    -moz-transition: 0.2s;
    -o-transition: 0.2s;
    transition-duration: 0.2s;
    z-index:2;
    }

    .benefitSwitcher li a:hover, .benefitSwitcher li.active a, .circleLink a {
    background: #49E2D6;
    color: #fff;
    z-index:2;
    }

    .circleLink a:hover { background-color: #000;
    }


    #bodyleft{
    z-index:2;
    }
    #bodyright{
    z-index:2;
    }

  • 最佳答案

    检查这个解决方案:

    http://jsfiddle.net/gtB9j/

    JS代码:

    $(document).ready(function(){

    $('li').click(function(){
    var newVal = $(this).data('name');
    $('#bodyright').find('h3').html(newVal);
    })
    });

    HTML代码:

    <div id="bodyleft">
    <ul class="benefitSwitcher">
    <li data-name="godzilla">one</li>
    <li data-name="pokemon">three</li>
    <li data-name="zombie">two</li>
    <li data-name="zorro">four</li>
    </ul>
    </div>

    关于JavaScript 目标。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20589621/

    32 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com