Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 28th, 2004, 07:30 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default ...not defined

Hi there

I've got this script that I'm using and I keep getting an error saying
't1 is undefined' on the line

    t1.src = "image_bin/thumbs/<%=strT1%>"


I thought I was defining it on this same line.

Basically what I'm attempting is to try and change the image when someone mouses over a thumbnail.

Here's the script below.

<script language="JavaScript" type="text/javascript">

    if (document.images) {
        Thumb1 = new Image
        Thumb2 = new Image
        Thumb3 = new Image
        Thumb4 = new Image
        Thumb5 = new Image

        t1.src = "image_bin/thumbs/<%=strT1%>"
        t2.src = "image_bin/thumbs/<%=strT2%>"
        t3.src = "image_bin/thumbs/<%=strT3%>"
        t4.src = "image_bin/thumbs/<%=strT4%>"
        t5.src = "image_bin/thumbs/<%=strT5%>"

        }

    else {

    t1 = ""
    t2 = ""
    t3 = ""
    t4 = ""
    t5 = ""
    document.main = ""

    }

    function chgImg(imgField,newImg) {
        if (document.images) {
            document[imgField].src= eval(newImg + ".src")
        }
    }


</script>

thanks alot

Adam

 
Old October 28th, 2004, 07:57 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Presumably t1 should have read Thumb1?

--

Joe
 
Old October 28th, 2004, 09:18 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

Hi Joe,

Well infact I'm hoping it will pick up whatever the person calls the image.

Would that work?

thanks

Adam






Similar Threads
Thread Thread Starter Forum Replies Last Post
ADODB.Connection user-defined type not defined Wall st Guru Excel VBA 2 March 26th, 2014 03:44 PM
Appl-defined or Object-defined error 1004 chp Excel VBA 3 April 4th, 2006 08:12 AM
User-defined type not defined (Icecream.mdb) dloren01 BOOK: Beginning Access VBA 0 June 22nd, 2005 10:36 PM
'OracleConnection' is not defined. nagender ASP.NET 1.x and 2.0 Application Design 2 May 24th, 2004 09:41 AM
Application-defined or object-defined error James Excel VBA 1 August 12th, 2003 11:50 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.