第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

從鏈接運(yùn)行腳本

從鏈接運(yùn)行腳本

PHP
肥皂起泡泡 2022-06-17 10:45:08
我有以下腳本在 div 中顯示我的信息,它工作得很好,但有一個按鈕......我試圖讓它從一個鏈接走,我嘗試了很多方法,但沒有,有什么想法嗎?<script>function showCustomer(str) {  var xhttp;      if (str == "") {    document.getElementById("contenido").innerHTML = "";    return;  }  xhttp = new XMLHttpRequest();  xhttp.onreadystatechange = function() {    if (this.readyState == 4 && this.status == 200) {      document.getElementById("contenido").innerHTML = this.responseText;    }  };  xhttp.open("GET", "getcustomer.php?q="+str, true);  history.pushState(null, "", str+ ".xhttp");  xhttp.send();}</script><input type='button' value='6df67913c1' onclick='showCustomer(this.value);' />
查看完整描述

3 回答

?
POPMUISE

TA貢獻(xiàn)1765條經(jīng)驗 獲得超5個贊

你必須做這樣的事情


const myLinkButton = document.getElementById('my-Link-button')

  ;

myLinkButton.onclick=e=>

  { 

  e.preventDefault()  // -> disable link action for new url

  console.log( myLinkButton.dataset.value )

  }

<a href="#" data-value="6df67913c1" id="my-Link-button" >button by link</a>


查看完整回答
反對 回復(fù) 2022-06-17
?
qq_笑_17

TA貢獻(xiàn)1818條經(jīng)驗 獲得超7個贊

利用<a href="JavaScript: void (0)" onclick="callYourFunction()>link<\a>



查看完整回答
反對 回復(fù) 2022-06-17
?
慕妹3146593

TA貢獻(xiàn)1820條經(jīng)驗 獲得超9個贊

你可以這樣做。


    <script>

        function showCustomer(element) {

          const str = element.getAttribute('data-value')

          var xhttp;    

          if (str == "") {

            document.getElementById("contenido").innerHTML = "";

            return;

          }

          xhttp = new XMLHttpRequest();

          xhttp.onreadystatechange = function() {

            if (this.readyState == 4 && this.status == 200) {

              document.getElementById("contenido").innerHTML = this.responseText;

            }

          };

          xhttp.open("GET", "getcustomer.php?q="+str, true);

          history.pushState(null, "", str+ ".xhttp");

          xhttp.send();

        }

    </script>

    <a href="#" onclick="showCustomer(this)" data-value="6df67913c1">Same, from link</a>



查看完整回答
反對 回復(fù) 2022-06-17
  • 3 回答
  • 0 關(guān)注
  • 144 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號