日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

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

發布時間:2024/4/19 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 html实现div打印,如何在html div的中间打印/附加从按钮单击的值? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

在帶有onclick功能(example here)的導航菜單上,顯示div標簽內容我想傳遞一個附加值來加載特定內容。這是當前的代碼:如何在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內得到第三個變量。我能夠看到它與alert(ThirdValue);,但使用我不能夠在html中添加它。

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

總結

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

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。