HighDots Forums  

get the number of the picture only

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss get the number of the picture only in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Imda14u
 
Posts: n/a

Default get the number of the picture only - 03-28-2009 , 09:29 AM






Hi all,

I am a newbie to this group, so please excuse me when i ask something
that already has been discussed.

this is my problem:
in a webpage i have an image called "images/1.jpg"
below the image is a button. the idea is when a user clicks the button
the page should load "2.jpg"
this means i'm looking fo a script that can take the number element of
the image only and then raise the number when a user clicks Next or
lower the number when a user clicks Previous.

any help is truly appreciated,


Sybolt

Reply With Quote
  #2  
Old   
RobertVA
 
Posts: n/a

Default Re: get the number of the picture only - 03-28-2009 , 11:57 PM






Imda14u wrote:
Quote:
Hi all,

I am a newbie to this group, so please excuse me when i ask something
that already has been discussed.

this is my problem:
in a webpage i have an image called "images/1.jpg"
below the image is a button. the idea is when a user clicks the button
the page should load "2.jpg"
this means i'm looking fo a script that can take the number element of
the image only and then raise the number when a user clicks Next or
lower the number when a user clicks Previous.

any help is truly appreciated,


Sybolt

It has been years since I've done it, but I once experimented with this.
There's an implementation on line, but the site operators wanted the
code a little challenging to actually read.

The solution involved a style sheet which contained multiple styles with
different background properties in each style. The actual page loaded
the graphics into an array (myimages[i].src=...) before filling the page
with content. The style property for the table cells were toggled in
response to onmouseover and onmouseout events (example:
onmouseover="this.classname="NormalBK". As a result the table full of
"buttons" flash as the site visitor moves the pointer across them and
execute a javascript procedure (different "buttons" displayed a pop-up
or shifted the user to a different page) when clicked.

You could probably load your series of images into an array and use
another page element's onclick event to increment (or decrement) a
counter variable. The counter variable could then be used to access an
array of style class names. You will probably have to name the element
you want to display image and use that object name in place of "this" in
your script to change the classname.


Reply With Quote
Reply




Thread Tools
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.