PDA

View Full Version : problem putting 2 scripts together


Toadward
27.05.2001, 13:07
Hi,

i've got a problem with some pieces of code i put together. It works if you run it with ie5.x or nn6.x, but with nn 4.7 it doesn't run :-(

I took the code of the dhtml guestbook (the preview function is done with dhtml) and added the code of the newsscroller-script. So if the message is longer than the layer, you may scroll through it.
As i mentioned already it works fine with ie5.x and nn6.x, but not with nn4.7x.

Also the guestbook script does not run on my machine with nn4.7x (local), but i tested it online, and there is no problem :-(

You may find my version at
http://www.toadward.de/test2.html


Can someone help me ??

Thx
Toadward

de.signed | design links
http://www.zoog.de

Edited by - Toadward on 05/27/2001 12:08:11

DCage
27.05.2001, 13:37
First you'll have to change the position styles for scrollerContainer and scrollerText to absolute -- NN4 doesn't like it if you try to write to relatively positioned layers.

Then change this line in writeIt():

this.writeref.write("text");

to this:

this.writeref.write(text);

The first one is causing it write "text" instead of the message passed to it.

To make it scroll, change this line in moveDown():

{ if(this.y>-this.scrollHeight+Container.clipHeight)

to this:

{ if(this.y>-this.clipHeight+Container.clipHeight)

since measuring the clip.height is more dependable than document.height for dynamic layers.

And if you want to retain the original styles when the text is updated (NN4 loses styles for a layer when you write to it), add these two lines somewhere after the browser check in the script:

wrap1= (bw.ns4)?'<span style="font-family:verdana,arial;font-size:10px">':'';
wrap2= (bw.ns4)?'</span>':'';

and change this line in preview():

text='Name:
'+form.name.value+'
Kommentar:
'+form.message.value+'
';

to this:

text=wrap1+'Name:
'+form.name.value+'
Kommentar:
'+form.message.value+'
'+wrap2;

Rod
27.05.2001, 14:47
Another demonstration of DHTML capabilities in NS4. Hehehe.

Your the man DCage.

Rad
[url="http://www.e-syed.net/viewsrc/"]viewsrc[/url:jl66yshdhq]

Toadward
28.05.2001, 15:22
Hi,
thx for your suggestions.
Some "mistakes" were not fixed by me before uploading the script like "text". That was just to try some things.

I will post my results here, when i changed the code you suggested..

Big thx
Toadward

de.signed | design links
http://www.zoog.de