473,396 Members | 2,011 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,396 software developers and data experts.

Javascript slideshow

Can anyone tell me how I can edit the script below (which I got off the
net) so that any pictures shown are resized to 120px wide?

Thank you

Ade
<SCRIPT LANGUAGE="JavaScript">
<!--

/*
Script by FPMC at http://jsarchive.8m.com
Submitted to JavaScript Kit (http://javascriptkit.com)
For this and 400+ free scripts, visit http://javascriptkit.com
*/

//set image paths
src = ["image1.gif", "image2.gif", "image3.gif", "image4.gif"]
//set corresponding urls
url = ["http://freewarejava.com", "http://javascriptkit.com",
"http://dynamicdrive.com", "http://www.geocities.com"]

//set duration for each image
duration = 4;

//Please do not edit below
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
document["Ad_Image"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);
}
function doLink(){
location.href = url[ct];
} onload = function(){
if (document.images)
switchAd();
}
//-->
</SCRIPT>

<A HREF="javascript:doLink();" onMouseOver="status=url[ct];return
true;"
onMouseOut="status=''">
<IMG NAME="Ad_Image" SRC="image1.gif" BORDER=0>
</A>

<p align="center"><font face="arial" size="-2">This free script
provided by <a href="http://javascriptkit.com">JavaScript
Kit</a></font></p>

Jul 23 '05 #1
6 1707
ASM
UKAde wrote:
Can anyone tell me how I can edit the script below (which I got off the
net) so that any pictures shown are resized to 120px wide?


no need JS :

<style type:"text/css">
img { width: 120px }
</style>

--
Stephane Moriaux et son [moins] vieux Mac
Jul 23 '05 #2
>no need JS :

<style type:"text/css">
img { width: 120px }
</style>
Thanks for that, but I have other pictures on the page i don't want to
resize which means I have to apply a class to the pictures i the
slideshow and I don't know how to do that either!

Any more help gratefully received...

Thanks
*** Sent via Developersdex http://www.developersdex.com ***
Jul 23 '05 #3
UKAde wrote on 13 jul 2005 in comp.lang.javascript:
no need JS :


<style type:"text/css">
img { width: 120px }
</style>
Thanks for that, but I have other pictures on the page i don't want to
resize which means I have to apply a class to the pictures i the
slideshow and I don't know how to do that either!

Any more help gratefully received...

Thanks


<style type:"text/css">
.small img, img.small { width: 80px }
</style>

<div class='small'>
<img src='img1.jpg'>
<img src='img2.jpg'>
<img src='img3.jpg'>
<img src='img4.jpg'>
</div>

<img src='normalImg.jpg'>

<img src='img5.jpg' class='small'>
<img src='img6.jpg' class='small'>
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #4
ASM
UKAde wrote:
no need JS :

<style type:"text/css">
img { width: 120px }
</style>
Thanks for that, but I have other pictures on the page i don't want to
resize which means I have to apply a class to the pictures i the
slideshow and I don't know how to do that either!


No to each image i
only to the image where slideshow is shown (Ad_image) :

<style type:"text/css">
#Ad_Image { width: 120px }
</style>
<A HREF="javascript:doLink();"
onMouseOver="status=url[ct];return true;"
onMouseOut="status=''">
<IMG NAME="Ad_Image" ID="Ad_Image" SRC="image1.gif" BORDER=0>
</A>

or directly without css:

<A HREF="javascript:doLink();"
onMouseOver="status=url[ct];return true;"
onMouseOut="status=''">
<IMG NAME="Ad_Image" SRC="image1.gif" BORDER=0
onload="this.width=120">
</A>
--
Stephane Moriaux et son [moins] vieux Mac
Jul 23 '05 #5
Hi Ade,
edit the script below (which I got off the net) so that any pictures shown are resized to 120px wide?


You don't even need to edit the script. Just add the width attribute
to the img tag in your html:

before:
<img name = "Ad_Image" src = "image1.gif" border = "0">

after:
<img name = "Ad_Image" src = "image1.gif" border = "0" width = "120"/>

If you also prefer to do it via inline css:
<img name = "Ad_Image" src = "iamge1.gif" border = "0" style = "width:
120px"/>

Hope this helps. :)

Jul 23 '05 #6
Ade
web.dev wrote:
You don't even need to edit the script. Just add the width attribute
to the img tag in your html:

before:
<img name = "Ad_Image" src = "image1.gif" border = "0">

after:
<img name = "Ad_Image" src = "image1.gif" border = "0" width = "120"/>

If you also prefer to do it via inline css:
<img name = "Ad_Image" src = "iamge1.gif" border = "0" style = "width:
120px"/>

Hope this helps. :)


Ah! I didn't bother with that line because I thought
it only applied to the opening image. Problem solved.
Thank you!
Jul 23 '05 #7

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

Similar topics

6
by: Terry | last post by:
Hi, I hope this problem I ran into has an easy fix. I created a menu bar for my page using Sothink DHTML Menu 4.1 which created javascript file. I also add a small slide show on the page...
2
by: Jeannie | last post by:
I have a popup window which is a slideshow of about 7 images. When the popup window loads, the first image is present and then the viewer can select next or previous to scroll through the rest of...
6
by: Dan Webb | last post by:
Hi All, Im currently working on ways of pacakaging javascript functions/variables/objects in a similar way to the Java package statement so that scripts can be interact with each other with the...
4
by: CB US 77 | last post by:
I use a piece of javascript to create a photo gallery slideshow. The slideshow part works great, but I would like to add captions to each picture. If you want to see the html, send me an email to...
5
by: Brian.Steele | last post by:
Greetings everyone. See http://www.spiceisle.com/cgi-bin/slideshow/slideshow.cgi?dir=brian/personal/2005/uk_trip/images&type=jpg The "Pause" button works in IE, but not in Firefox. Any ideas...
22
by: bevoldjling | last post by:
Hi ! I need some help in putting together a website for our family gathering. Although I'm still pretty "green", I don't think what I need requires terribly advanced skills ...except for one...
1
by: gencode | last post by:
I have this bit if javascript and it animates an image well, the problem is that the more it runs the more memory it eats on the client machine. Can anyone help me make this not eat all avaliable...
3
by: Gaby Sandoval | last post by:
I have a very simple javascript slideshow. It is extremely basic (see small sample below): <script language="JavaScript1.1"> <!-- //specify interval between slide (in mili seconds) var...
8
by: pitstop10 | last post by:
I use cutehtml as these are my starting days with Javascripts. The script generated by CuteHTML works in IE and Opera. It does not however work in Mozilla. its a slideshow of images. The problem with...
3
by: krzysztof.murkowski | last post by:
Hi, I have problem with JavaScript for gallery of images. From the overview page with thumbnails, after a click on the small picture, the subpage 'slide_show.html' is called, with a number of...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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.