57

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 .

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..

I'm a newbie so yeah :\

Community
  • 1
  • 1
user1053018
  • 613
  • 1
  • 5
  • 5

2 Answers2

142
document.getElementById("serverTime").innerHTML = ...;
SLaks
  • 837,282
  • 173
  • 1,862
  • 1,933
7

Replace whatever is in the address bar with this:

javascript:document.getElementById('serverTime').innerHTML='[text here]';

Example.

Purag
  • 16,611
  • 4
  • 51
  • 72