Javascript question

N

nazgulero

Hello,

I am trying to create a slideshow with Javascript and found the script
below, which is very nice. The only thing I want is to add a
description to every image that appears in the slideshow, the script
below only show the full sized image.
Does anybody have an idea if that is possible using this script, or
does anybody have another script which lets me do that ?
Thanks a bunch in advance for your help !

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--

// canManipulateImages - check if the browser we're using can do
// clever stuff with document images.

function canManipulateImages() {
if (document.images)
return true;
else
return false;
}

// loadPosterImage

function loadPosterImage(imageURL) {
if (gImageCapableBrowser) {
document.imagePoster.src = imageURL;
return false;
}
else {
return true;
}
}

// gImageCapableBrowser - is this browser hip to images? Set up
// a global variable so that we don't have to keep calling a function
// (useful if the function becomes costly to compute).

gImageCapableBrowser = canManipulateImages();

// -->
</SCRIPT>

<TABLE CELLPADDING=10 CELLSPACING=5 WIDTH="95%" ALIGN=CENTER>
<TR>
<TD VALIGN=TOP ALIGN=CENTER>
<A HREF="inline/imageNaiad.jpg"
onClick="return(loadPosterImage('inline/imageNaiad.jpg'))">
<IMG SRC="inline/imageNaiadSmall.jpg"
ALT="Naiad" BORDER=0 ALIGN=TOP WIDTH=56 HEIGHT=75></A>
<P CLASS="thumbcaption">Naiad Beauty Products</P>
</TD>
<TD VALIGN=TOP ALIGN=CENTER>
<A HREF="inline/imageAdonis.jpg"
onClick="return(loadPosterImage('inline/imageAdonis.jpg'))">
<IMG SRC="inline/imageAdonisSmall.jpg"
ALT="Adonis" BORDER=0 ALIGN=TOP WIDTH=56 HEIGHT=75></A>
<P CLASS="thumbcaption">Bronze Adonis</P>
</TD>
<TD WIDTH=250 VALIGN=TOP ALIGN=CENTER ROWSPAN=3>
<IMG SRC="inline/imageNaiad.jpg" NAME="imagePoster"
ALT="Naiad" ALIGN=TOP WIDTH=225 HEIGHT=300>
</TD>
</TR>
<TR>
<TD VALIGN=TOP ALIGN=CENTER>
<A HREF="inline/imageRodin.jpg"
onClick="return(loadPosterImage('inline/imageRodin.jpg'))">
<IMG SRC="inline/imageRodinSmall.jpg"
ALT="Rodin" BORDER=0 ALIGN=TOP WIDTH=56 HEIGHT=75></A>
<P CLASS="thumbcaption">Rodin Consulting</P>
</TD>
<TD VALIGN=TOP ALIGN=CENTER>
<A HREF="inline/imageSwami.jpg"
onClick="return(loadPosterImage('inline/imageSwami.jpg'))">
<IMG SRC="inline/imageSwamiSmall.jpg"
ALT="Swami" BORDER=0 ALIGN=TOP WIDTH=56 HEIGHT=75></A>
<P CLASS="thumbcaption">Swami Academy</P>
</TD>
</TR>
<TR>
<TD VALIGN=TOP ALIGN=CENTER>
<A HREF="inline/imagePassion.jpg"
onClick="return(loadPosterImage('inline/imagePassion.jpg'))">
<IMG SRC="inline/imagePassionSmall.jpg"
ALT="Passion" BORDER=0 ALIGN=TOP WIDTH=56 HEIGHT=75></A>
<P CLASS="thumbcaption">Plastic Passion</P>
</TD>
<TD VALIGN=TOP ALIGN=CENTER>
<A HREF="inline/imageAtlas.jpg"
onClick="return(loadPosterImage('inline/imageAtlas.jpg'))">
<IMG SRC="inline/imageAtlasSmall.jpg"
ALT="Atlas" BORDER=0 ALIGN=TOP WIDTH=56 HEIGHT=75></A>
<P CLASS="thumbcaption">Atlas Removals</P>
</TD>
</TR>
</TABLE>

Regards,

GP
 
D

Dr John Stockton

JRS: In article <[email protected]>,
dated Fri, 17 Jun 2005 13:49:10, seen in
nazgulero said:
function canManipulateImages() {
if (document.images)
return true;
else
return false;
}

That, unless you are paid by the yard, can be written more like


function canManipulateImages() {
return !!document.images
}

or

function canManipulateImages() { !!return document.images }
 
Y

Yann-Erwan Perio

Dr John Stockton wrote:

Hi John,
function canManipulateImages() { !!return document.images }

Et là, c'est le drame.

In current javascript, the "logical not" operator "!" is applied to a
following unary expression - not a statement.

Favorite hot beverage break ? ;-)


Cheers,
Yep.
 
R

RobG

Dr John Stockton wrote:
[...]
That, unless you are paid by the yard, can be written more like

Indeed. The function is used to assign a value to the global
variable gImageCapableBrowser, which itself contains 5 more
characters that the equivalent (and more direct):

if ( document.images ) {
...
}

:)
 
D

Dr John Stockton

JRS: In article <[email protected]>, dated Sun, 19
Jun 2005 01:31:41, seen in Yann-Erwan Perio
Dr John Stockton wrote:

Hi John,


Et là, c'est le drame.

In current javascript, the "logical not" operator "!" is applied to a
following unary expression - not a statement.

Favorite hot beverage break ? ;-)

Indeed; but the typo was evident from what you did not quote.

What's a unary expression as opposed to any other sort of expression?
 
Y

Yann-Erwan Perio

Dr John Stockton wrote:

What's a unary expression as opposed to any other sort of expression?

The ECMAScript specification defines several types of expressions, in
order to precisely describe the language grammar; among these
expressions, listed in ECMA262-3 A3, has been defined UnaryExpression,
which is basically[1] an expression following a unary operator
(ECMA262-3, 11.4).

UnaryExpression :
PostfixExpression
delete UnaryExpression
void UnaryExpression
typeof UnaryExpression
++ UnaryExpression
-- UnaryExpression
+ UnaryExpression
- UnaryExpression
~ UnaryExpression
! UnaryExpression


Cheers,
Yep.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top