Closed Thread Icon

Preserved Topic: Changing text... (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=17956" title="Pages that link to Preserved Topic: Changing text... (Page 1 of 1)" rel="nofollow" >Preserved Topic: Changing text... <span class="small">(Page 1 of 1)</span>\

 
mahjqa
Maniac (V) Mad Scientist

From: The Demented Side of the Fence
Insane since: Aug 2000

posted posted 05-10-2001 20:46

I'm working on a new design and I wanted to implement a little thing into it, a kind of screen which provides some info about a link when you hover over the link. Just like the text in your browser status bar, but now in the website itself. I have a basic understanding of Javascript, but I ran into this problem:

How do you change text on a page? I don't want that info screen to be some ugly input field or dropdown menu, just plain text. But as you can't assign a name to text just like to an image, how could you do something like this? The only thing I've seen which comes close is document.write , but by using that you'll have to refresh the full page. (or a frame, and I don't like frames) Do you have any suggestions?



mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 05-10-2001 21:30

It would take me some time (which I don't currently have) to explain this completely (especially, since there's different code for NS and IE), but basically in IE/W3C DOM you modify innerHTML layer property and this can help you get started: http://www.wsabstract.com/script/script2/coolmenu.shtml

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 05-10-2001 22:41

Well, allow me to attempt a simple explanation. This will only work in IE and Mozilla/Netscape 6, to do it in Net Nav is a bit annoying, and has a few flaws, that can be explained later.

<div id="sometext">Hi! I'm text. blah blah blah and etc etc etc.</div>

Note that you don't have to use a DIV tag. You could use <p id="mytext"> or <span id="doobeedoobeedoo"> or <td id="imatabletaghello"> - you name it. It should work. Actually, no, in Netscape Nav I think only the div tag will work, and it will also have to be absolutely positioned (which is another story). I hate that browser. Ugh. But aside from that, you *should* be able to use any of the above.

Then, in JS code:

document.getElementById("sometext").innerHTML = "Hi! I'm new text to be put in the HTML tag with the id \"sometext\". You can put <b>HTML</b> tags in this string too!";

And that should do it! Note that I haven't shown you how to actually make the text *float* or anything, that would require absolute positioning (and simultaneously make this possible in Netscape Nav, which is a good thing, I suppose). You can just put that DIV tag anywhere you want in the HTML page.

Hope that helps.

- Slime

mahjqa
Maniac (V) Mad Scientist

From: The Demented Side of the Fence
Insane since: Aug 2000

posted posted 05-11-2001 14:04

Thanks Max & Slime! I guess I need to get NN from somewhere.... I think I'll be able to figure it out.



ZOX
Bipolar (III) Inmate

From: Southern Alabama, USA
Insane since: Sep 2000

posted posted 05-11-2001 16:17

http://www.bosrup.com/web/overlib/

probably not exactly what you are looking for, but it's an idea.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 05-11-2001 22:07

Check out my example at http://www.development.runningwolf.com/development/code/mouseover_text.htm

Hope this helps.

Pat Richard
A pixel is worth a thousand words.
http://www.gurusnetwork.com
ICQ 23113317

Dracusis
Maniac (V) Inmate

From: Brisbane, Australia
Insane since: Apr 2001

posted posted 05-11-2001 23:55

Wouldn't it just be simpler to have the text in a larer '<DIV>' then just have a hide/show function set to it.

Oh and I don't think that getElementById works in IE 4, only 5.0+ but I could be wrong.


Dracusis

« BackwardsOnwards »

Show Forum Drop Down Menu