[Javascript] Comparing Strings

Timothy White weirdit at gmail.com
Thu Aug 25 22:39:39 CDT 2005


On 8/26/05, Triche Osborne <wdlists at triche-osborne.com> wrote:
> Triche Osborne wrote:
> >
> > var replacements = new Array();
> > replacements[0] = ("Hi there!/span");
> > replacements[1] = ("Bonjour!/"p","span"/"error");
> >
> Nice. That last should have been:
> replacements[1] = ("Bonjour!/p,span/error");
> 
> Sorry. I've been a bit distracted by a pet emergency for a couple of
> days. But since you're a seasoned programmer (even if not JS), I expect
> you get my drift about use of the array despite the quote error.

Lol. yes I get your drift. i didn't even notice that someone had
posted an error earlier on. I just coded it without the error without
thinking.

Unfortunately I think there is to much formatting for me to do it like
that. I basically get a large chunk of html, which is already
formatted, and place it in the div. And that html changes every once
in a while (currently a line is removed, and a new one is added on the
end). This is a sample of the contents of the div.[1] One of the lines
that starts with a timestamp span would be missing in the new html,
and a new on one the end. and the topic div sometimes changes. Now I
think about it I /could/ do this with javascript, load up an initial
'template' and fill in the values, remove first child nodes, and
append new nodes... I was doing this for an initial working solution
before i started working on it more.

Also, while we are talking about it. Is there a way to scroll the
container div to the bottom? Initially my idea was to not remove the
top line, just keep appending (the topic floats over the top via CSS)
lines and have it scroll to the bottom automatically. I'd probably
want something that checked if they had manually scrolled up to read
previous lines, and only scroll if there were at the bottom (or close
to it).

Just for the curious. This is all for a project I've been working on
for a while. Feel free to look at it. I'm using the AJAX to replace
the object's that auto refresh every x seconds and cause of that they
'flicker'. The objects will be the fall back, and AJAX for those who
can use it.
http://ihcc.sf.net/demo for the 'released' version.
http://members.plug.org.au/~linuxalien/public/talk/dev/ for the
developing version (not the bleeding edge version, that's still on my
comp, and until i get the AJAX working I won't upload it.)

Thanks

Tim

[1]
<div class="spacer">&nbsp;</div>
<div class="topic">
		<div class="topicis">TOPIC</div>
		<em>Random Text</em>
</div>
<div class="spacer">&nbsp;</div>
<span class="timestamp">(25/08/05 21:32:38)</span><span class="name">
Weirdo</span>: lots or random sayings!<br/>
<span class="timestamp">(26/08/05 11:06:02)</span><span class="name">
Weirdo</span>: more random text<br/>
<span class="timestamp">(26/08/05 11:06:06)</span><span class="name">
Weirdo</span>: and more<br/>
<span class="timestamp">(26/08/05 11:06:08)</span><span class="name">
Weirdo</span>: and more<br/>



More information about the Javascript mailing list