JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 21st, 2002, 11:14 PM
Tag Tag is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Colorado
Posts: 4 Tag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question How do I add links to my Javascript Photo Album?

Hello Everybody!

I have a javascript photo album at this address:

URL

I would like to be able to have a different link for each picture in the album.

Any input would be greatly appreciated.

Thanks

~Tag

Reply With Quote
  #2  
Old April 22nd, 2002, 12:07 AM
mrrichardfeder mrrichardfeder is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 765 mrrichardfeder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 45 sec
Reputation Power: 7
I'd consider re-doing the whole thing along more object-oriented lines - but this might get you by:

var picURLS = new Array(); //for demo
picURLS[0] = 'javascript:alert("URL 0")';
picURLS[1] = 'javascript:alert("URL 1")';
picURLS[2] = 'javascript:alert("URL 2")';
picURLS[3] = 'javascript:alert("URL 3")';
picURLS[15] = 'javascript:alert("URL 15")';
picURLS[14] = 'javascript:alert("URL 14")';
picURLS[13] = 'javascript:alert("URL 13")';


function back(name) {
if (browserOK) {
pics[name]["pos"]--;
if (pics[name]["pos"]<0) pics[name]["pos"]= pics[name]["count"]-1;
document.images[name].src= pics[name][pics[name]["pos"]].src;
document.images[name].onmousedown = function() {
this.clicked = true;
}
document.images[name].onmouseup = function() {
if (this.clicked) location = picURLS[pics['pic1']["pos"]];
}
}
}

function forward(name) {
if (browserOK) {
pics[name]["pos"]++;
if (pics[name]["pos"]>=pics[name]["count"]) pics[name]["pos"]= 0;
document.images[name].src= pics[name][pics[name]["pos"]].src;
document.images[name].onmousedown = function() {
this.clicked = true;
}
document.images[name].onmouseup = function() {
if (this.clicked) location = picURLS[pics['pic1']["pos"]];
}
}
}

// preload images
.......................

onload = function() {
document['pic1'].onmousedown = function() {
this.clicked = true;
}
document['pic1'].onmouseup = function() {
if (this.clicked) location = picURLS[pics['pic1']["pos"]];
}
}
// -->

</script>
</head>

[tested:IE5.5,6,NS4,6]

Reply With Quote
  #3  
Old April 22nd, 2002, 12:52 AM
Tag Tag is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Colorado
Posts: 4 Tag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Almost there!

Thanks for your help MrRichardFeder.

Your Code definately put me in the right direction!

(URL)

But what I am trying to accomplish is an actual link to the site when you click on the image.

I am so very close!!!

Amy Ideas???

Reply With Quote
  #4  
Old April 22nd, 2002, 12:57 AM
mrrichardfeder mrrichardfeder is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 765 mrrichardfeder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 45 sec
Reputation Power: 7
hey Tag..

Just replace the

'javascript:alert("URL 0")';

...with an actual URL (in quotes)!

Notice the image onclick in Netscape 4 - only available in JavaScript. If you want a hand cursor, add this to the image tag:

<center><p><img src="images/portfolio/pawnee.jpg" alt="" border="0" name="pic1" style="cursor:hand;">

That might be 'pointer' in Moz; I'm too tired to remember.

cheers...

Reply With Quote
  #5  
Old April 22nd, 2002, 01:12 AM
Tag Tag is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Colorado
Posts: 4 Tag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cool Nice Job!

Thank You So Much!

Your code has worked!

There is one last and final thing I have to ask...

Is there a way to get the linked site to open in a new window?

That would be the icing on the cake!

Thanks so much again for your help!

~Tag

Reply With Quote
  #6  
Old April 22nd, 2002, 01:32 AM
mrrichardfeder mrrichardfeder is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 765 mrrichardfeder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 45 sec
Reputation Power: 7
Tag -

Off to bed (zzzz).

Find a good pop-up script (google.com) and just plug that URL in there:

if (this.clicked) openPopUp(picURLS[pics['pic1']["pos"]]);

Reply With Quote
  #7  
Old April 22nd, 2002, 02:31 AM
Tag Tag is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Colorado
Posts: 4 Tag User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up It all works!

MrRichardFeder -

I cannot thank you enough!

With a little determination and your help, I have achieved my goal!

Here is the link again in case you wanted to see the finished product:

URL

Thanks again for all of your help!

I really appreciate it!

~Tag

Reply With Quote
  #8  
Old April 22nd, 2002, 10:51 PM
mrrichardfeder mrrichardfeder is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Nov 2001
Posts: 765 mrrichardfeder User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m 45 sec
Reputation Power: 7
~Tag...

Hey, you're welcome. Pasted in a pop-up script I dug out from the archives. Help yourself; play with the numbers if you like. It's optimized for an 800x600 display, but can be altered easily. Hope it's of use.

cya
Attached Files
File Type: zip tag_work.htm.zip (2.5 KB, 485 views)

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > How do I add links to my Javascript Photo Album?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway