help with arrays

P

precon1

I am trying to update in FrontPage, Web pages which were created in
PageMaker. I am not a programmer and the pages contain arrays. Is there a
simple way to update or add pages/items to an array? I've had a little
success, but I'm sure there must be an easier way than what I'm doing.
 
K

Kevin Spencer

Arrays of what?

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
 
P

precon1

Pictures. If you look at our Web site, www.EDCweb.com, click on overview,
then find in the middle the hyperlink to "clients", there are copies of
scanned letters and when you click the forward arrow, it is supposed to go to
the next letter. I was not quite sure how to add new letters but I gave it a
whirl by looking for some pattern in the code, and now it doesn't advance in
order. I may be referring to this as an array and it isn't actually one.
Thank you!
 
K

Kevin Spencer

Okay, we're talking about JavaScript here, which means scripting or
programming. The only way to change the script is to rewrite the code. It's
a bit sophisticated as well. I could figure it out, but it would take more
time than I have. Your best bet is to study the code until you understand
it. Or find a JavaScript expert to do it for you.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
 
T

Trevor L.

precon1 said:
Pictures. If you look at our Web site, www.EDCweb.com, click on
overview, then find in the middle the hyperlink to "clients", there
are copies of scanned letters and when you click the forward arrow,
it is supposed to go to the next letter. I was not quite sure how to
add new letters but I gave it a whirl by looking for some pattern in
the code, and now it doesn't advance in order. I may be referring to
this as an array and it isn't actually one. Thank you!

Wow, this is horribly complex.

The code has tags in it that I have never seen e.g <csaction> <csobj>

This is the code that is behind the arrow
<p class=MsoNormal style="text-align:left">
<csobj w="27" h="27" t="Button" ht="../media/popup/all/nexroll.gif" csclick="BC65244A21" cl="../media/popup/all/next.gif">
<a href="#" onmouseover="return CSIShow(/*CMP*/'first image arrow',1)"
onmouseout="return CSIShow(/*CMP*/'first image arrow',0)"
onclick="CSAction(new Array(/*CMP*/'BC65244A21')); CSIShow(/*CMP*/'first image arrow',2); return CSClickReturn()">
<img src="../media/popup/all/next.gif" width="27" height="27" name="first image arrow" border="0"></a>
</csobj>
</p>

So a click on the arrow appears to be executing the functions CSAction, CSIShow and CSClickReturn.

If I knew where to find all the code, I would search for arrays in a js file (suffix .js) and check what order its elements are in.
As CSAction has an array as its parameter, I would look for this 'BC65244A21'

Anyway, Kevin has much greater knwoledge than I, so maybe he'll be able to put you on track.
 
K

Kevin Spencer

Anyway, Kevin has much greater knwoledge than I, so maybe he'll be able to
put you on track.

You're too kind, Trevor. In fact, I agree with you that "it's horribly
complex." There are no external JavaScripts in the page, only 2 script
blocks.

The tags you found so confusing are in fact, simply non-existant HTML tags.
I can't remember seeing them used this way before, but browsers will ignore
tags they don't recognize, so they were probably used in the same way as
comments (not at all standards-compliant, but works).

The most complex aspect of the code is the use of objects. JavaScript is
"pseudo-object-oriented" in that you can define objects in JavaScript, but
they are variant objects, and do not support encapsulation, inheritance, and
polymorphism in the way that true OOP does. A JavaScript object is basically
an aggregate of process and data that can be changed in structure at any
time. Because such objects are variant in nature, it's pretty hard to follow
the code in such a script. It can be done, but it's a rather painstaking
process.

The script also uses browser-detection, which is fairly straightforward, and
cryptic naming, which is not. On first blush, it looks like what it's doing
is using an array of images, combined with an array of URLs, to build
dynamically a changing image that, when clicked, opens a new window with the
URL of the current image loaded in it.

Unfortunately, I just don't have the hour or so to take it apart.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
 
T

Trevor L.

Kevin said:
You're too kind, Trevor. In fact, I agree with you that "it's horribly
complex." There are no external JavaScripts in the page, only 2 script
blocks.

The tags you found so confusing are in fact, simply non-existant HTML
tags. I can't remember seeing them used this way before, but browsers
will ignore tags they don't recognize, so they were probably used in
the same way as comments (not at all standards-compliant, but works).

The most complex aspect of the code is the use of objects. JavaScript
is "pseudo-object-oriented" in that you can define objects in
JavaScript, but they are variant objects, and do not support
encapsulation, inheritance, and polymorphism in the way that true OOP
does. A JavaScript object is basically an aggregate of process and
data that can be changed in structure at any time. Because such
objects are variant in nature, it's pretty hard to follow the code in
such a script. It can be done, but it's a rather painstaking process.

The script also uses browser-detection, which is fairly
straightforward, and cryptic naming, which is not. On first blush, it
looks like what it's doing is using an array of images, combined with
an array of URLs, to build dynamically a changing image that, when
clicked, opens a new window with the URL of the current image loaded
in it.
Unfortunately, I just don't have the hour or so to take it apart.

Well, thanks for that info. - great stuff as always, which I need to digest.

I am glad that I wasn't alone in thinking this would be difficult to decipher

I wonder whether the OP would not be better off rewriting the whole thing using "plain" J(ava)Script, i.e., just set up an array of
images, and a button which invokes a JS function which simply uses setInterval to cycle through the images. The same button could
also be used to stop the cycling.

Here is a function which does a similar task
<script type = "text/javascript">
var ss_run, ss_lock = false
function auto()
{
if (!ss_lock)
ss_run = setInterval("chgImg(1)", 5000)
else
window.clearInterval(ss_run)
ss_lock = !ss_lock
}
</script>

It is invoked by
<input type="button" size="10" value="Start/Stop Slideshow" onclick="auto()" />

chgImg is simply a function which increments a global counter and retrieves the next image from the array into id = "slide"
<img id="slide" src="" alt="" />

The basics of it are (array example from my site):
var ss_ImgNum = 0
var Pictures = new Array(
"0000-90-nessie" ,
"01-03-16-michelles-birth-16th-march-2001" ,
"02-01-27-michelle-10mths" ,
"02-06-06-phil-and-michelle" ,
"02-11-03-melissa" ,
"04-11-22-kate-and-julie" ,
"04-01-21-6-adam-on-sprinkler" ,
"04-01-21-bryan-on-sprinkler")
function chgImg(){
document.getElementById('slide').src = "images/" + Pictures[ss_ImgNum] + ".jpg"
ss_ImgNum ++
if (ss_ImgNum >= Pictures.length)
ss_imgNum = 0
}

My function has more than this in it; I have just extracted what I think is important and made a few (untested) changes
 
Top