473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Javascript question

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

Jul 23 '05 #1
5 1245
JRS: In article <11*********************@g47g2000cwa.googlegroups. com>,
dated Fri, 17 Jun 2005 13:49:10, seen in news:comp.lang.javascript,
nazgulero <ge**********@wanadoo.nl> posted :

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 }

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #2
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.
Jul 23 '05 #3
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 ) {
...
}

:-)

--
Rob
Jul 23 '05 #4
JRS: In article <42**********************@news.free.fr>, dated Sun, 19
Jun 2005 01:31:41, seen in news:comp.lang.javascript, Yann-Erwan Perio
<ye*@invalid.com> posted :
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 ? ;-)


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?

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #5
Dr John Stockton wrote:

<snip>
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.

---
[1] The PostfixExpression is listed as a UnaryExpression, and can
concern different types of other expressions.
Jul 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.