/    Sign up×
Community /Pin to ProfileBookmark

Image gallery project – formating title

Hello again, I am still working on this project, [URL=”http://www.timelessurns.com/handmade3.html”]www.timelessurns/handmade3.html
[/URL]

Things are going well so far, I can click on a thumbnail and the gallery and the desdription both change as they are supposed to!!! My problem to overcome now is that the description is dependent on the title of the thumbnail and I would like it to look nice. I can set the Style in the DIV to change the color, size and font but it all comes out in one line. so when I want it to read:
[INDENT]
URN # W 112

White glaze with peach top

9.5” tall, 6.5” wide
280 cubic inch
Price: $ 295.00[/INDENT]

but it will only output:

[INDENT]URN # W 112 White glaze with peach top 9.5? tall, 6.5? wide 280 cubic inch Price: $ 295.00[/INDENT]

Then on top of that I would like it to have an active link for each image either in the description or in the gallery image.

Here is my javascript(thank you Jeremy Keith):

[CODE]function showPic(whichpic) {
var source = whichpic.getAttribute(“href”);
var placeholder = document.getElementById(“placeholder”);
placeholder.setAttribute(“src”,source);
var text = whichpic.getAttribute(“title”);
var description = document.getElementById(“description”); description.firstChild.nodeValue = text;
}[/CODE]

It seems like I could do something with getElementByTagName to create an onclick event in the gallery image. but I just haven’t learned enough to write it out or even to know if it is possible.

If someone could point me in the right direction for these two issues I would be grateful.

Thanks,

Jason

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Arty_EffemSep 26.2006 — Hello again, I am still working on this project, [URL="http://www.timelessurns.com/handmade3.html"]www.timelessurns/handmade3.html

[/URL]


Things are going well so far, I can click on a thumbnail and the gallery and the desdription both change as they are supposed to!!! My problem to overcome now is that the description is dependent on the title of the thumbnail and I would like it to look nice. I can set the Style in the DIV to change the color, size and font but it all comes out in one line.[/QUOTE]
I don't know a way to generate newlines in text node data, but if you insert <BR> tags into your title text, this modified function will use innerHTML (where available) to convert them to newlines, otherwise they will be just removed.[CODE]function showPic(whichpic) {
var source = whichpic.getAttribute("href");
var placeholder = document.getElementById("placeholder");
placeholder.setAttribute("src",source);
var text = whichpic.getAttribute("title");
var description = document.getElementById("description");

if(description)
if( typeof description.innerHTML!='undefined' )
description.innerHTML=text;
else
description.firstChild.nodeValue = text.replace(/<br>/ig,' ');
}[/CODE]
Copy linkTweet thisAlerts:
@azwliauthorSep 26.2006 — Thank you, that really helped alot. Now all I have to do figure out the link thing.
×

Success!

Help @azwli spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...