开发者

Text on button in HTML

开发者 https://www.devze.com 2023-04-04 13:01 出处:网络
I have following code in HTML: http://pastebin.com/GfrE1Pkh I want to add text to banner_button_1 and banner_butt开发者_如何学编程on_2. How can I do that?

I have following code in HTML:

http://pastebin.com/GfrE1Pkh

I want to add text to banner_button_1 and banner_butt开发者_如何学编程on_2. How can I do that?

Thanks!


This code is horrible, but I'll assume that you can not edit the HTML and just want to change it via JS.

var bannerButton = document.getElementsByClassName('banner-button')[0];

var bannerButtonLinks = bannerButton.getElementsByTagName('a');

bannerButtonLinks [0].innerHTML += "text for banner_button_1";

bannerButtonLinks [1].innerHTML += "text for banner_button_2";
0

精彩评论

暂无评论...
验证码 换一张
取 消