Closed Thread Icon

Topic awaiting preservation: Changing &lt;div&gt; contents. (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=7914" title="Pages that link to Topic awaiting preservation: Changing &amp;amp;lt;div&amp;amp;gt; contents. (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Changing &amp;lt;div&amp;gt; contents. <span class="small">(Page 1 of 1)</span>\

 
jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-06-2001 17:55

So as you may have noticed I am new to the dHTML thing, but I need to suck up to the main web designer here at the University, and he needs help with a thing.

I know to reference a <div> cross-browserly style you need to check document.all and getElementByID(). The question now is how do I change the contents of a <div id="changeMe">?

In IE it would be document.all[changeMe].innerHTML = "New text biatch"

correct?

But what about NN4 or 6 or Opera or anything else for that matter? How can I cover my bases here?

-jiblet

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 11-06-2001 19:34

document.all[changeMe].innerHTML = "New text biatch"
is wrong... it's either
document.all.changeMe.innerHTML = "New text biatch"
or
document.all["changeMe"].innerHTML = "New text biatch"
but what you wrote assumes that changeMe is a string variable, who's value is the ID of some element.

So that's in IE. In Mozilla and other standard-compliant browsers, it's just

document.getElementById(changeMe).innerHTML = "New text biatch"

in NN 4.x, it's:

document.changeMe.document.write("New text biatch");
document.changeMe.document.close();

In Opera, it's impossible. There aren't even any workarounds to do it. *Nothing* works, except for using images and then changing them.

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-06-2001 21:22

Thanks for the help.

Should it actually be:

document.getElementById('changeMe') ?

-jiblet

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 11-06-2001 21:25

Oops, hah, yeah. I made the same mistake you did. =)

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-06-2001 21:38

Not having any luck in NN, check it out:
http://www.coffman.umn.edu/test.html

Works great in IE & Mozilla though. Also, I know it's making it into the loop in NN, but the changes aren't showing./



-jiblet

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-06-2001 21:39

hah, it's not letting me edit because it said I was tring to hack the topic subject.

I just wanted to change the word 'loop' to 'conditional'

-jiblet

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-06-2001 21:57

I did a little research, and it would seem absolute CSS positioning is necessary for NS 4 to work. Is there no way around this? Or can it be absolutely positioned relatively so it stays where it is defined on the page?

The whole idea was to make something simple, but if I'm going to have to use absolutely positioned <div>s I may as well use overLIB.

-jiblet

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-07-2001 15:39

I take it the silence means no?

-jiblet

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-07-2001 16:01

jiblet: At times like these I suspect it might be handy if you told us what you are planning on doing with this - it may be that there is an easier way of doing what you want (or not).

Emps


You're my wife now Dave

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 11-07-2001 16:23

Oops, sorry, I sort of glazed over this message a few times. Yeah, you're right, in NN it has to be absolutely positioned for it to be considered a layer. Sorry about that. You might try position:relative; left:0; top:0; and see if *that* works; then it would at least be in the place you expected it to be. I'm not sure if that'll work though, but give it a try.

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-07-2001 16:46

I've not yet tried it yet in NS4.x but I am fiddling with something that has an absolutely positioned DIV inside a relatively positioned one. Well while I'm talking about it I may as well check - no that example works in IE5 but not NS4.x although it might work in a simpler example so I'd try a quick test to see.

Emps


You're my wife now Dave

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 11-07-2001 17:11

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 11-07-2001 18:01

No, InI, you *don't* want to say "layers" there. It *might* work with it, but I've never used it, personally. I vaguely remember trying it and having it fail. You just want

document.changeMe.document.whatever.

*Unless* you're saying that this will remove the necessity of absolutely positioning it.

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-07-2001 18:09

Well actually I had already tried that and it failed.

-jiblet

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-07-2001 18:15

Oh, and Emp, what I am trying to do is create a simple way to display a random message. The tricky part is that it is not my page, I am just trying to help the lead web designer here at the University of Minnesota. You can see the page at http://www1.umn.edu/campuslife/indexf.html

It uses GoLive functions (ew), and works in NN4, but obviously the display sucks. My quick fix to this problem is to just make NN4 show an alert, as per my example at http://www.coffman.umn.edu/test.html

I also talked on the phone to the guy just now, and he asked if we could use images. That would indeed simplify things except for the question of the alt-tag. Can the alt-tag be reliable modified thru javascript without need for CSS level 2?

-jiblet

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-07-2001 19:12

jiblet: Displaying a random message (you mean like a quote, for example?) shouldn't be a problem if I understand you correctly although I'm not sure how it directly relates to the example you gave (apart from the dynamic writing bit). WarMage's random logo script:
www.gurusnetwork.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=18&t=000028

is nicely adaptable to all sorts of situations (I've used it as a basis for giving a random style on a page) and it looks like it should work for what I think you are aiming for (without the need for graphics).

If that isn't what you were aiming for then let us know and we'll try again.

Emps


You're my wife now Dave

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 11-07-2001 22:28

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 11-07-2001 22:31

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 11-07-2001 22:36

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 11-08-2001 03:25

Yeah, I got the same thing when trying to edit your post, InI. You know what it probably is? Look at thie subject of this page; it contains "<div>". Those angle brackets *shouldn't* be allowed in a subject line; it's a UBB bug, I believe. Note that the top of the replying page says "Topic: Changing <" and cuts it off there. It's just a UBB bug, and just in this thread.

Anyway, perhaps both of our methods work. Personally, I've never used the word "layers" except to test if NN is the current browser.

jiblet
Paranoid (IV) Inmate

From: Minneapolis, MN, USA
Insane since: May 2000

posted posted 11-08-2001 15:58

Oopz, I guess I forgot to submit my response to Emperor yesterday.

Emp, that is indeed a fine solution. The difference is that we want somethign to appear when you click on a button so that you can view multiple fortunes without a reload.

Ini, that solution is almost good, but you still have the absolute positioning problem of things overlapping. The only way to prevent that would be to have everything in the absolute positioned <div>, but then you wouldn't be able to isolate the individual text to replace. So in short I think there is no adequate solution.

BTW, yeah I had the same problem editing posts as you can read above. I used &amp;gt; to make the title which looks like it had unfortunate side effects. Normally UBB doesn't let you use greater and less-thans in the title.

-jiblet

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-08-2001 17:56

jiblet: OK I see. I'm wondering if the solution I proposed in the other thread would also work here:
www.ozoneasylum.com/Forum2/HTML/001143.html

Emps


You're my wife now Dave

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 11-08-2001 18:39

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu