亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

Maths Capture 需要添加到同一 html 頁面上的兩個選項卡?

Maths Capture 需要添加到同一 html 頁面上的兩個選項卡?

鴻蒙傳說 2022-12-29 14:14:59
我附上了一個顯示代碼的片段。我正在嘗試在同一 HTML 頁面上的兩個不同選項卡上添加兩個 Math Capture。因此,在“新聞”選項卡上,捕獲工作正常,但在“聯系方式”選項卡上,數學問題不會只顯示一個空白框。但是聯系人選項卡中的提交按鈕在新聞選項卡中有效,但它使用新聞選項卡中的數學問題是錯誤的。我不確定如何讓它在兩個頁面上都起作用?希望你能幫忙??謝謝蒂姆function openPage(pageName, elmnt, color) {  // Hide all elements with class="tabcontent" by default */  var i, tabcontent, tablinks;  tabcontent = document.getElementsByClassName("tabcontent");  for (i = 0; i < tabcontent.length; i++) {    tabcontent[i].style.display = "none";  }  // Remove the background color of all tablinks/buttons  tablinks = document.getElementsByClassName("tablink");  for (i = 0; i < tablinks.length; i++) {    tablinks[i].style.backgroundColor = "";  }  // Show the specific tab content  document.getElementById(pageName).style.display = "block";  // Add the specific color to the button used to open the tab content  elmnt.style.backgroundColor = color;}// Get the element with id="defaultOpen" and click on itdocument.getElementById("defaultOpen").click();var total;function getRandom(){return Math.ceil(Math.random()* 20);}function createSum(){        var randomNum1 = getRandom(),            randomNum2 = getRandom();    total =randomNum1 + randomNum2;  $( "#question" ).text( randomNum1 + " + " + randomNum2 + "=" );    $("#ans").val('');  checkInput();}function checkInput(){        var input = $("#ans").val(),         slideSpeed = 200,      hasInput = !!input,       valid = hasInput && input == total;    $('#message').toggle(!hasInput);    $('button[type=submit]').prop('disabled', !valid);      $('#success').toggle(valid);    $('#fail').toggle(hasInput && !valid);}$(document).ready(function(){    //create initial sum    createSum();    // On "reset button" click, generate new random sum    $('button[type=reset]').click(createSum);    // On user input, check value    $( "#ans" ).keyup(checkInput);});
查看完整描述
  • 1 回答
  • 0 關注
  • 113 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號