Javascript 更改跨度文本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8177215/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change span text?
提问by user1053018
Possible Duplicate:
How do I change the text of a span element in javascript
Well, I've searched a lot for the answer to this, but still I couldn't find it. What I did find didn't work.
嗯,我已经搜索了很多答案,但仍然找不到。我发现的没有用。
What I'm trying to do is, basically, using JavaScript: At the browser's bar, not via Greasemonkey or something else, edit a span's text .
我想要做的是,基本上,使用 JavaScript:在浏览器的栏中,而不是通过 Greasemonkey 或其他东西,编辑 span 的 text 。
This' the span that contains the text I want to edit:
这是包含我要编辑的文本的跨度:
<span id="serverTime">5:46:40</span>
The time within is just random, don't pay attention to it, it's what I want to edit using javascript..
里面的时间只是随机的,不要在意,这是我想用javascript编辑的..
I'm a newbie so yeah :\
我是新手所以是的:\
回答by SLaks
document.getElementById("serverTime").innerHTML = ...;