日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

html实现div打印,如何在html div的中间打印/附加从按钮单击的值?

發(fā)布時(shí)間:2024/4/19 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html实现div打印,如何在html div的中间打印/附加从按钮单击的值? 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

在帶有onclick功能(example here)的導(dǎo)航菜單上,顯示div標(biāo)簽內(nèi)容我想傳遞一個(gè)附加值來加載特定內(nèi)容。這是當(dāng)前的代碼:如何在html div的中間打印/附加從按鈕單擊的值?

  • London
  • Paris
  • Tokyo

London

London is the city of England.

Paris

Paris is the capital of .

Tokyo

Tokyo is the capital of .

這是JavaScript:

function openCity(evt, cityName, ThirdValue) {

// Declare all variables

var i, tabcontent, tablinks;

// Get all elements with class="tabcontent" and hide them

tabcontent = document.getElementsByClassName("tabcontent");

for (i = 0; i < tabcontent.length; i++) {

tabcontent[i].style.display = "none";

}

// Get all elements with class="tablinks" and remove the class "active"

tablinks = document.getElementsByClassName("tablinks");

for (i = 0; i < tablinks.length; i++) {

tablinks[i].className = tablinks[i].className.replace(" active", "");

}

// Show the current tab, and add an "active" class to the link that opened the tab

document.getElementById(cityName).style.display = "block";

evt.currentTarget.className += " active";

alert(ThirdValue);

}

我不能到div內(nèi)得到第三個(gè)變量。我能夠看到它與alert(ThirdValue);,但使用我不能夠在html中添加它。

我需要在html中添加此值。我該如何在html中打印/追加這個(gè)值?

總結(jié)

以上是生活随笔為你收集整理的html实现div打印,如何在html div的中间打印/附加从按钮单击的值?的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。