thumbnail navigator
i am trying to get a thumbnail navigator script to open the image in a new window, it is the script from the javascript source
http://javascript.internet.com/navigation/thumbnail-navigator.html
i need the image to open in a new window instead of the one it is already in, but i am not too good with javascript so i dont even know where to start. can someone please help me out?
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
Busy posted this at 23:18 — 27th September 2002.
He has: 6,151 posts
Joined: May 2001
try add target="_blank" into this line
jammin posted this at 23:20 — 27th September 2002.
They have: 222 posts
Joined: Sep 2002
nope, i have already tried that, it wont load the image.
Busy posted this at 23:35 — 27th September 2002.
He has: 6,151 posts
Joined: May 2001
doh, looked at the code again, didnt see the link() first time
*still on my first cup of coffee*
function link() {
location.href=eval("link" + count);
I can't remember off hand, but think it's location.parent.href .. or something like that.
If no one has given you the correct way I'll try look it up for you once the caffine has kicked in
jammin posted this at 23:40 — 27th September 2002.
They have: 222 posts
Joined: Sep 2002
thanks this really helps me out.
jammin posted this at 01:00 — 28th September 2002.
They have: 222 posts
Joined: Sep 2002
hmm well anyone have any idea how to get it to work?
Busy posted this at 02:24 — 28th September 2002.
He has: 6,151 posts
Joined: May 2001
ok I'm not the best at javascript, but try this
replace
function link() {
location.href=eval("link" + count);
}
with
function link(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + (WIDTH+50) + ",height=" + (HEIGHT+50);
preview = window.open("", "preview", windowprops);
preview.document.open();
text = "<img src=";
text += window.open=eval("link" + count);
text += ">";
preview.document.write(text);
preview.document.close();
}
It seems to work, but am sure someone else will (hopefully) show an easier or better way to do it. I just copied a section from another script at http://javascriptsource.com/
jammin posted this at 02:36 — 28th September 2002.
They have: 222 posts
Joined: Sep 2002
thanks...
you know, that kind of thing is why i dont like using javascript much.
but it still doesnt work. the image still wont load, it loads fine when i dont try to open it in a new window though, but thats really not an option to have them in the same window.
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
Busy posted this at 02:44 — 28th September 2002.
He has: 6,151 posts
Joined: May 2001
hmm it worked for me, opened in new window (new window was big), I didnt download any images but the source code of the new window showed the tag with image name in it.
Sorry am not much help, am sure one of the JavaScript gurus can help you out, still late else where in the world, so should be along later.
jammin posted this at 02:57 — 28th September 2002.
They have: 222 posts
Joined: Sep 2002
ok nevemind i got it to work, i just moved all of the images to another folder and that one worked. not quite sure why though.
thanks for all the help!
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
jammin posted this at 03:06 — 28th September 2002.
They have: 222 posts
Joined: Sep 2002
... ok then, well i guess it isnt working, it will load the first image, but when i switch images and try to open the second, it gives me an error that says
"'preview.document' is null or not an object"
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
taff posted this at 10:13 — 28th September 2002.
They have: 956 posts
Joined: Jun 2001
Try this:
in header...
function Popup(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=no,menubar=no,location=no,scrollbars=no,resize=yes,height=520,width=475");
}
note that you can configure height, width, etc above
link...
a href="javascript:Popup('yourpage.html')"
Have a sample of what you are trying to do? Might be easier if I see "under the hood"
.....
jammin posted this at 16:07 — 28th September 2002.
They have: 222 posts
Joined: Sep 2002
<script language="javascript">
prev1 = new Image (32,18);
prev1.src = "prev1.jpg";
prev2 = new Image (32,18);
prev2.src = "prev2.jpg";
next1 = new Image (32,18);
next1.src = "next1.jpg";
next2 = new Image (32,18);
next2.src = "next2.jpg";
go1 = new Image (48,24);
go1.src = "go1.jpg";
go2 = new Image (48,24);
go2.src = "go2.jpg";
maxPic = 5;
p1 = new Image (144,96);
p1.src = "/pics/001.jpg";
link1 = "/pics/001.jpg";
p2 = new Image (144,96);
p2.src = "/pics/002.jpg";
link2 = "/pics/002.jpg";
p3 = new Image (144,96);
p3.src = "/pics/003.jpg";
link3 = "/pics/003.jpg";
p4 = new Image (144,96);
p4.src = "/pics/004.jpg";
link4 = "/pics/004.jpg";
p5 = new Image (144,96);
p5.src = "/pics/005.jpg";
link5 = "/pics/005.jpg";
count = 1;
function next() {
count++;
if (count > maxPic) {
count = 1;
}
eval("document.p.src=p" + count + ".src");
}
function back() {
count--;
if (count == 0) {
count = maxPic;
}
eval("document.p.src=p" + count + ".src");
}
function link(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + (WIDTH+50) + ",height=" + (HEIGHT+50);
preview = window.open("", "preview", windowprops);
preview.document.open();
text = "";
preview.document.write(text);
preview.document.close();
}
//
</script>
thats the whole script.
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
Busy posted this at 22:44 — 28th September 2002.
He has: 6,151 posts
Joined: May 2001
jammin, you might want to change that link() function back to what it was
Abhishek Reddy posted this at 23:05 — 28th September 2002.
He has: 3,348 posts
Joined: Jul 2001
What you could do is pass the path to the image along to the new window, in which there is a document.write script that writes that image... hold on a few minutes and I'll see if I can write some code up.
Abhishek Reddy posted this at 08:03 — 29th September 2002.
He has: 3,348 posts
Joined: Jul 2001
Dang it, I ran dead into a brick wall there, mate. Sorry about that... couldn't get my idea to work. I'll have a look again later to see if I can figure out what's wrong. Hope I didn't keep ya waiting.
jammin posted this at 18:57 — 29th September 2002.
They have: 222 posts
Joined: Sep 2002
well it works fine until you try to open a second image, then it just gives an error. if someone could figure that out then there wouldnt really be a problem.
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
jammin posted this at 21:58 — 30th September 2002.
They have: 222 posts
Joined: Sep 2002
i have an idea, and tell me if im wrong or just being stupid.
but wouldnt it be possible to do something on the lines of
if count=1, then
if count=2, then... and so on and so on.
from what i know about javascript this seems like it might work, but im still trying to learn it so im not sure.
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
jammin posted this at 22:30 — 1st October 2002.
They have: 222 posts
Joined: Sep 2002
YES I GOT IT TO WORK!!!!!
<script language="javascript">
prev1 = new Image (32,18);
prev1.src = "prev1.jpg";
prev2 = new Image (32,18);
prev2.src = "prev2.jpg";
next1 = new Image (32,18);
next1.src = "next1.jpg";
next2 = new Image (32,18);
next2.src = "next2.jpg";
go1 = new Image (48,24);
go1.src = "go1.jpg";
go2 = new Image (48,24);
go2.src = "go2.jpg";
maxPic = 5;
p1 = new Image (144,96);
p1.src = "/pics/001.jpg";
link1 = "/pics/001.jpg";
p2 = new Image (144,96);
p2.src = "/pics/002.jpg";
link2 = "/pics/002.jpg";
p3 = new Image (144,96);
p3.src = "/pics/003.jpg";
link3 = "/pics/003.jpg";
p4 = new Image (144,96);
p4.src = "/pics/004.jpg";
link4 = "/pics/004.jpg";
p5 = new Image (144,96);
p5.src = "/pics/005.jpg";
link5 = "/pics/005.jpg";
count = 1;
function next() {
count++;
if (count > maxPic) {
count = 1;
}
eval("document.p.src=p" + count + ".src");
}
function back() {
count--;
if (count == 0) {
count = maxPic;
}
eval("document.p.src=p" + count + ".src");
}
function link() {
document.href=open("/pics/00" + count + ".jpg");
}
//
</script>
anyone can do any amount of work provided it isnt the work they are supposed to be doing.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.