SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Feb 2002
    Location
    Oklahoma
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Dynamically generated Javascript

    I am creating some javascript on the server side and placing in a page. It is to create somethumbnails that when you roll over it replaces the main image with the thumbnail image. The javascript apperas to be created OK but throws an error when you roll over the thumbnail.
    Code:
    <script language="Javascript">
    browserVer = 0
    if (document.images) browserVer = "n3";
    function ImgChange(imgNum,imgSrc) {
    if (browserVer == "n3" ) {
    document.images([imgNum].src = eval(imgSrc + ".src" )) //Line 21
    }
    }
    if (browserVer == "n3" ) {
    ImageFull1 = new Image();
    ImageFull1.src = "http://pictures1.ourdomain.com/highres/157263-1.jpg"
    ImageThumb1 = new Image();
    ImageThumb1.src = "http://pictures1.ourdomain.com/Media...lr157263-1.jpg"
    ImageFull2 = new Image();
    ImageFull2.src = "http://pictures1.ourdomain.com/highres/157263-2.jpg"
    ImageThumb2 = new Image();
    ImageThumb2.src = "http://pictures1.ourdomain.com/Media...lr157263-2.jpg"
    ImageFull3 = new Image();
    ImageFull3.src = "http://pictures1.ourdomain.com/highres/157263-3.jpg"
    ImageThumb3 = new Image();
    ImageThumb3.src = "http://pictures1.ourdomain.com/Media...lr157263-3.jpg"
    ImageFull4 = new Image();
    ImageFull4.src = "http://pictures1.ourdomain.com/highres/157263-4.jpg"
    ImageThumb4 = new Image();
    ImageThumb4.src = "http://pictures1.ourdomain.com/Media...lr157263-4.jpg"
    ImageFull5 = new Image();
    ImageFull5.src = "http://pictures1.ourdomain.com/highres/157263-5.jpg"
    ImageThumb5 = new Image();
    ImageThumb5.src = "http://pictures1.ourdomain.com/Media...lr157263-5.jpg"
    ImageFull6 = new Image();
    ImageFull6.src = "http://pictures1.ourdomain.com/highres/157263-6.jpg"
    ImageThumb6 = new Image();
    ImageThumb6.src = "http://pictures1.ourdomain.com/Media...lr157263-6.jpg"
    ImageFull7 = new Image();
    ImageFull7.src = "http://pictures1.ourdomain.com/highres/157263-7.jpg"
    ImageThumb7 = new Image();
    ImageThumb7.src = "http://pictures1.ourdomain.com/Media...lr157263-7.jpg"
    ImageFull8 = new Image();
    ImageFull8.src = "http://pictures1.ourdomain.com/highres/157263-8.jpg"
    ImageThumb8 = new Image();
    ImageThumb8.src = "http://pictures1.ourdomain.com/Media...lr157263-8.jpg"
    ImageFull9 = new Image();
    ImageFull9.src = "http://pictures1.ourdomain.com/highres/157263-9.jpg"
    ImageThumb9 = new Image();
    ImageThumb9.src = "http://pictures1.ourdomain.com/Media...lr157263-9.jpg"
    ImageFull10 = new Image();
    ImageFull10.src = "http://pictures1.ourdomain.com/highres/157263-10.jpg"
    ImageThumb10 = new Image();
    ImageThumb10.src = "http://pictures1.ourdomain.com/Media...r157263-10.jpg"
    }
    </script>
    
    
    <TABLE id="ImagesTable" cellSpacing="1" cellPadding="1" width="100%" align="left" border="0">
    <TR>
    <TD style="HEIGHT: 16px" align="left">
    <!-- This is the main image that is swapped out-->
    <img id="MLSDetailControl1_detailReport__ctl0_PropertyImagesControl1_imgPropertyPhoto1" name="ImageFull" src="<A href="http://pictures1.ourdomain.com/highres/143125_0.jpg">http://pictures1.ourdomain.com/highres/143125_0.jpg" alt="MLS Property Photo" border="0" style="height:151px;width:320px;" /></TD>
    </TR>
    <TR>
    <TD align="left">
    <!-- These are the thumbnails-->
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull1')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-1.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-1.jpg" name="imageThumb1" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull2')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-2.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-2.jpg" name="imageThumb2" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull3')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-3.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-3.jpg" name="imageThumb3" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull4')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-4.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-4.jpg" name="imageThumb4" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull5')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-5.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-5.jpg" name="imageThumb5" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull6')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-6.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-6.jpg" name="imageThumb6" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull7')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-7.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-7.jpg" name="imageThumb7" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull8')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-8.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-8.jpg" name="imageThumb8" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull9')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-9.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-9.jpg" name="imageThumb9" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a> 
    <a href="#" onMouseOver="ImgChange('ImageFull', 'ImageFull10')"><img src="<A href="http://pictures.ourdomain.com/MediaDisplay/lr157263-10.jpg">http://pictures.ourdomain.com/MediaDisplay/lr157263-10.jpg" name="imageThumb10" border=1 width=40 height=30 vspace=5 hspace=5 alt="MLS Property Image"></a>
    </TD>
    </TR>
    </TABLE>
    The error is:
    Line 21 char1
    object does not support this action

    Help. I do not do alot of client side scripting.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    That grouping doesn't look right. Try this instead:
    Code:
    document.images[imgNum].src = eval(imgSrc + ".src" )

  3. #3
    SitePoint Addict
    Join Date
    Feb 2002
    Location
    Oklahoma
    Posts
    228
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey thanks alot. That worked just fine.

  4. #4
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by vishrb
    Hey thanks alot. That worked just fine.
    No problem


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •