By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,607 Members | 1,764 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,607 IT Pros & Developers. It's quick & easy.

right idea.....but lost somewhere

P: n/a
This simple change to dynamicdrive's textual tooltip does what I want
perfectly.
(whichcontent) determines which group of thumbs will be shown.
My color coded editor is showing me that something is not quite kosher and I
can't figure out what it is.
Everything appears to be fine up until you get to i<10 then it screws up.

I know everything else works fine.
With a click, I can put a single image into my "middle" column with ease.
But I want to show the entire group of thumbs, not just one.

Any clues appreciated.

function changethumbs(whichcontent){

if (document.all||document.getElementById){
cross_el=document.getElementById?
document.getElementById("middle"):document.all.mid dle
counter=0
for (i=1; i<10; i++){
counter=counter+1
cross_el.innerHTML='<img src="images/pic"+i+".jpg">'

}
}

}
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Screw it. This innerhtml thing is not gonna do what I need done no way.
Jul 23 '05 #2

P: n/a
Richard wrote:
This simple change to dynamicdrive's textual tooltip does what I want
perfectly.
(whichcontent) determines which group of thumbs will be shown.
My color coded editor is showing me that something is not quite kosher and I
can't figure out what it is.
Everything appears to be fine up until you get to i<10 then it screws up.
i<10 means that it will stop when i reaches 9.

I know everything else works fine.
With a click, I can put a single image into my "middle" column with ease.
But I want to show the entire group of thumbs, not just one.

function changethumbs(whichcontent){

if (document.all||document.getElementById){
cross_el=document.getElementById?
document.getElementById("middle"):document.all.mid dle
this can be written a little more legibly as:

if (document.getElementById){
var cross_el = document.getElementById('middle');
} else if (document.all) {
var cross_el = document.all['middle'];
}
counter=0
Don't know what "counter" is for, but make it local if not needed as
global:

var counter = 0;
for (i=1; i<10; i++){
This for loop will iterate 9 times, from 1 to 9 inclusive. If you want
more, say 20, change i<10 to i<=20.
counter=counter+1
cross_el.innerHTML='<img src="images/pic"+i+".jpg">'


"cross_el" must be a div or span or similar, so this can be
replaced by:

if (document.createElement) {
counter++;
var image = document.createElement('img');
image.src = 'images/pic' + i + '.jpg';
image.alt = 'nothing';
cross_el.appendChild(image);
}

[...]

--
Rob
Jul 23 '05 #3

P: n/a
Thanks Rob I'll look into it.

Jul 23 '05 #4

P: n/a
I must be missing something because I can't get your idea to work right.
Thanks for the lesson.
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.