HTML/Java help **Codes guys get in here***

Discussion in 'OT Technology' started by boend1, Jul 29, 2004.

  1. boend1

    boend1 OT Supporter

    Aug 26, 2002
    Likes Received:
    New Jersey
    ok so i am making a slideshow of images on my website. i recently asked for help on adding captions to the images. the problem now is that the images cant change sizes. in other words, the website takes the size of the first image and stretches and compresses the other images to fit that size. any ideas on how to force it to change sizes?

    also, it worked fine when i load it from my computer, but when i load it from the web it doesnt work right

    Here is the code btw:

    <SCRIPT language=JavaScript type=text/JavaScript>
    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a)&&x.oSrc;i++) x.src=x.oSrc;

    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

    <SCRIPT LANGUAGE="JavaScript">

    NewImg = new Array (

    Caption = new Array (
    "Caption for image1",
    "Caption for image2",
    "Caption for image3",
    "Caption for image4",
    "Caption for image5",
    "Caption for image6",
    "Caption for image7",
    "Caption for image8",
    "Caption for image9",
    "Caption for image10",
    "Caption for image11",
    "Caption for image12",
    "Caption for image13",
    "Caption for image14",
    "Caption for image15",
    "Caption for image16",
    "Caption for image17",
    "Caption for image18",
    "Caption for image19",
    "Caption for image20",
    "Caption for image21",
    "Caption for image22",
    "Caption for image23",
    "Caption for image24",
    "Caption for image25",
    "Caption for image26"


    var ImgNum = 0;
    var ImgLength = NewImg.length - 1;

    //Time delay between Slides in milliseconds
    var delay = 3000;

    var lock = false;
    var run;
    function chgImg(direction) {
    if (document.images) {
    ImgNum = ImgNum + direction;
    if (ImgNum > ImgLength) {
    ImgNum = 0;
    if (ImgNum < 0) {
    ImgNum = ImgLength;
    document.slideshow.src = NewImg[ImgNum];
    function auto() {
    if (lock == true) {
    lock = false;
    else if (lock == false) {
    lock = true;
    run = setInterval("chgImg(1)", delay);

    <TD vAlign=top align=middle width=610 bgColor=#999999>&nbsp;<p>&nbsp;

    <!-- Change below for first image and caption in slideshow!-->

    <img src="Pictures/2003_09_12/103_0358.jpg" name="slideshow">
    <br><font color="#FFFFFF"><span id="caption">Caption for image1</span>
    <td align="right">
    <a href="javascript:chgImg(-1)">
    <img border="0" src="Pictures/Prev.gif" width="33" height="23"></a></td>
    <td align="center"><a href="javascript:auto()">
    <img border="0" src="Pictures/Play.gif" width="33" height="23"></a></td>
    <td align="left"><a href="javascript:chgImg(1)">
    <img border="0" src="Pictures/Next.gif" width="33" height="23"></a></td>


    Thanks for any help
  2. WERUreo

    WERUreo Imua!

    Oct 15, 2003
    Likes Received:
    Daytona Beach, Florida
    You're using Dreamweaver, aren't you? I can tell you're using some pre-fab Javascript code from some WYSIWYG editor, and it looks like what Dreamweaver does. Anyway, without trying to decipher the actual Javascript code, because I don't think it holds any size information anyway, why don't you try this.

    Take the width="" and height="" out of the img tags (the bolded stuff above). That should solve it. If it doesn't, I'll try to take a closer look at the actual Javascript.
  3. boend1

    boend1 OT Supporter

    Aug 26, 2002
    Likes Received:
    New Jersey
    that is just the width and height of the buttons that make it go to the next picture, not the actual pictures themselves as i said, it works when i load it from my hard drive, but not when its published to the web so im looking for a way to force it to change sizes
  4. kingtoad

    kingtoad Well-Known Member

    Sep 2, 2003
    Likes Received:
    Los Angeles
    Java != Javascript
  5. WERUreo

    WERUreo Imua!

    Oct 15, 2003
    Likes Received:
    Daytona Beach, Florida
    Is there a live link I could possibly look at? I have a feeling that I'm not seeing everything I'd need to see to help you.

    Oh yeah, and like kingtoad said, Java and Javascript are two completely different things...

Share This Page