Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asptoday_discuss thread: Simple Javascript/ASP problem


Message #1 by "laeg byrne" <laeg_enterprises@y...> on Mon, 14 Jan 2002 12:58:13
I have an image, when I do a mouseover on the image I want a message to 

pop up. Naturally I use alt="message"



however in this case alt is update when the page is rendered, I use asp 

for this. However if I hardcoded in alt="this is my message" it would show 

but if I put the message in a text variable in asp and had 



Dim mytextvariable

mytextvariable="this is my message"

Response.write "<img src='mypic.gif' alt=" & mytextvariable & ">"



 it will only show the first letter of the message ie the word 'this' but 

not the rest of the message. Any ideas????
Message #2 by "Paul HUGUET" <paul@m...> on Mon, 14 Jan 2002 13:56:40 +0100
This is a multi-part message in MIME format.



------=_NextPart_000_00B2_01C19D03.4A6859E0

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



May be you shoudl try this



Response.write "<img src=3D""mypic.gif"" alt=3D""" & mytextvariable & 

""">"



You need to put the result of your variable between " " to send it in 

alt



Hope it helps









  ----- Message d'origine -----

  De : laeg byrne

  =C0 : ASPToday Discuss

  Envoy=E9 : lundi 14 janvier 2002 12:58

  Objet : [asptoday_discuss] Simple Javascript/ASP problem





  I have an image, when I do a mouseover on the image I want a message 

to

  pop up. Naturally I use alt=3D"message"



  however in this case alt is update when the page is rendered, I use 

asp

  for this. However if I hardcoded in alt=3D"this is my message" it 

would show

  but if I put the message in a text variable in asp and had



  Dim mytextvariable

  mytextvariable=3D"this is my message"

  Response.write "<img src=3D'mypic.gif' alt=3D" & mytextvariable & ">"



   it will only show the first letter of the message ie the word 'this' 

but

  not the rest of the message. Any ideas????








Message #3 by "=?iso-8859-1?q?Laeg=20Ent.?=" <laeg_enterprises@y...> on Mon, 14 Jan 2002 14:17:29 +0000 (GMT)
Merci beaucoup Paul, ca marche bien, merci encore.



Laeg

  

--- Paul HUGUET <paul@m...> wrote: > May be

you shoudl try this

> 

> Response.write "<img src=""mypic.gif"" alt=""" &

> mytextvariable & """>"

> 

> You need to put the result of your variable between

> " " to send it in alt

> 

> Hope it helps

> 

> 

> 

>  

>   ----- Message d'origine ----- 

>   De : laeg byrne 

>   À : ASPToday Discuss 

>   Envoyé : lundi 14 janvier 2002 12:58

>   Objet : [asptoday_discuss] Simple Javascript/ASP

> problem

> 

> 

>   I have an image, when I do a mouseover on the

> image I want a message to 

>   pop up. Naturally I use alt="message"

> 

>   however in this case alt is update when the page

> is rendered, I use asp 

>   for this. However if I hardcoded in alt="this is

> my message" it would show 

>   but if I put the message in a text variable in asp

> and had 

> 

>   Dim mytextvariable

>   mytextvariable="this is my message"

>   Response.write "<img src='mypic.gif' alt=" &

> mytextvariable & ">"

> 

>    it will only show the first letter of the message

> ie the word 'this' but 

>   not the rest of the message. Any ideas????

>  



__________________________________________________

Do You Yahoo!?

Everything you'll ever need on one web page

from News and Sport to Email and Music Charts

http://uk.my.yahoo.com

Message #4 by "Laurence Flello" <info@i...> on Wed, 16 Jan 2002 20:22:11
> I have an image, when I do a mouseover on the image I want a message to 

> pop up. Naturally I use alt="message"

> 

> however in this case alt is update when the page is rendered, I use asp 

> for this. However if I hardcoded in alt="this is my message" it would 

show 

> but if I put the message in a text variable in asp and had 

> 

> Dim mytextvariable

> mytextvariable="this is my message"

> Response.write "<img src='mypic.gif' alt=" & mytextvariable & ">"

> 

>  it will only show the first letter of the message ie the word 'this' 

but 

> not the rest of the message. Any ideas????

should be like this

 Dim mytextvariable

 mytextvariable="this is my message"

 Response.write "<img src='mypic.gif' alt='" & mytextvariable & "'>"
Message #5 by "Pat Sullivan" <PSullivan@m...> on Wed, 16 Jan 2002 15:01:33 -0600



You might try encapsulating the alt message with double quotes..



Dim mytextvariable

mytextvariable=3D"this is my message"

Response.write "<img src=3D""mypic.gif"" alt=3D""" & mytextvariable & 

""">"





-----Original Message-----

From: Laurence Flello [mailto:info@i...]

Sent: Wednesday, January 16, 2002 2:22 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem





> I have an image, when I do a mouseover on the image I want a message

to

> pop up. Naturally I use alt=3D"message"

>

> however in this case alt is update when the page is rendered, I use

asp

> for this. However if I hardcoded in alt=3D"this is my message" it 

would

show

> but if I put the message in a text variable in asp and had

>

> Dim mytextvariable

> mytextvariable=3D"this is my message"

> Response.write "<img src=3D'mypic.gif' alt=3D" & mytextvariable & ">"

>

>  it will only show the first letter of the message ie the word 'this'

but

> not the rest of the message. Any ideas????

should be like this

 Dim mytextvariable

 mytextvariable=3D"this is my message"

 Response.write "<img src=3D'mypic.gif' alt=3D'" & mytextvariable & "'>"

Message #6 by "Rich McQuaid" <remcq@m...> on Wed, 16 Jan 2002 17:51:59 -0500
I tried this. It worked fine.



Dim mytextvariable



<% mytextvariable="this is my message" %>



<img src="mypic.gif" alt="<%=mytextvariable%>">













-----Original Message-----

From: Pat Sullivan [mailto:PSullivan@m...] 

Sent: Wednesday, January 16, 2002 4:02 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem









You might try encapsulating the alt message with double quotes..



Dim mytextvariable

mytextvariable="this is my message"

Response.write "<img src=""mypic.gif"" alt=""" & mytextvariable & """>"





-----Original Message-----

From: Laurence Flello [mailto:info@i...]

Sent: Wednesday, January 16, 2002 2:22 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem





> I have an image, when I do a mouseover on the image I want a message

to 

> pop up. Naturally I use alt="message"

> 

> however in this case alt is update when the page is rendered, I use

asp 

> for this. However if I hardcoded in alt="this is my message" it would

show 

> but if I put the message in a text variable in asp and had

> 

> Dim mytextvariable

> mytextvariable="this is my message"

> Response.write "<img src='mypic.gif' alt=" & mytextvariable & ">"

> 

>  it will only show the first letter of the message ie the word 'this'

but 

> not the rest of the message. Any ideas????

should be like this

 Dim mytextvariable

 mytextvariable="this is my message"

 Response.write "<img src='mypic.gif' alt='" & mytextvariable & "'>"



Message #7 by "Pat Sullivan" <PSullivan@m...> on Wed, 16 Jan 2002 16:56:04 -0600
Yeah that would work, I always just hate going in and out of ASP like

that. Not sure why though.









-----Original Message-----

From: Rich McQuaid [mailto:remcq@m...]

Sent: Wednesday, January 16, 2002 4:52 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem





I tried this. It worked fine.



Dim mytextvariable



<% mytextvariable=3D"this is my message" %>



<img src=3D"mypic.gif" alt=3D"<%=3Dmytextvariable%>">













-----Original Message-----

From: Pat Sullivan [mailto:PSullivan@m...]

Sent: Wednesday, January 16, 2002 4:02 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem









You might try encapsulating the alt message with double quotes..



Dim mytextvariable

mytextvariable=3D"this is my message"

Response.write "<img src=3D""mypic.gif"" alt=3D""" & mytextvariable & 

""">"





-----Original Message-----

From: Laurence Flello [mailto:info@i...]

Sent: Wednesday, January 16, 2002 2:22 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem





> I have an image, when I do a mouseover on the image I want a message

to

> pop up. Naturally I use alt=3D"message"

>

> however in this case alt is update when the page is rendered, I use

asp

> for this. However if I hardcoded in alt=3D"this is my message" it 

would

show

> but if I put the message in a text variable in asp and had

>

> Dim mytextvariable

> mytextvariable=3D"this is my message"

> Response.write "<img src=3D'mypic.gif' alt=3D" & mytextvariable & ">"

>

>  it will only show the first letter of the message ie the word 'this'

but

> not the rest of the message. Any ideas????

should be like this

 Dim mytextvariable

 mytextvariable=3D"this is my message"

 Response.write "<img src=3D'mypic.gif' alt=3D'" & mytextvariable & "'>"





Message #8 by "Rich McQuaid" <remcq@m...> on Wed, 16 Jan 2002 19:26:04 -0500
They say having more script tags makes things run slower, but I've never

seen it as a signigicant problem.



If this is an issue for you,try it this way :



<%Dim mytextvariable



 mytextvariable="this is my message" 

 

Response.Write "<img src="

Response.Write chr(34)

Response.Write "myimage.gif"

Response.Write chr(34)

Response.Write " alt="

Response.Write chr(34)

Response.Write mytextvariable

Response.Write chr(34)

Response.Write	">"

 %>



If you want to do it with just one response.write you can string each of

the statements together with "&"

Like this:



Response.Write "<img src=" & chr(34) & "myimage.gif" & chr(34) &" alt="

& chr(34) & mytextvariable & chr(34) & ">"





That can be kind of tough on the eyes when you get something wrong and

you need to debug it.







-----Original Message-----

From: Pat Sullivan [mailto:PSullivan@m...] 

Sent: Wednesday, January 16, 2002 5:56 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem





Yeah that would work, I always just hate going in and out of ASP like

that. Not sure why though.









-----Original Message-----

From: Rich McQuaid [mailto:remcq@m...]

Sent: Wednesday, January 16, 2002 4:52 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem





I tried this. It worked fine.



Dim mytextvariable



<% mytextvariable="this is my message" %>



<img src="mypic.gif" alt="<%=mytextvariable%>">













-----Original Message-----

From: Pat Sullivan [mailto:PSullivan@m...] 

Sent: Wednesday, January 16, 2002 4:02 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem









You might try encapsulating the alt message with double quotes..



Dim mytextvariable

mytextvariable="this is my message"

Response.write "<img src=""mypic.gif"" alt=""" & mytextvariable & """>"





-----Original Message-----

From: Laurence Flello [mailto:info@i...]

Sent: Wednesday, January 16, 2002 2:22 PM

To: ASPToday Discuss

Subject: [asptoday_discuss] Re: Simple Javascript/ASP problem





> I have an image, when I do a mouseover on the image I want a message

to 

> pop up. Naturally I use alt="message"

> 

> however in this case alt is update when the page is rendered, I use

asp 

> for this. However if I hardcoded in alt="this is my message" it would

show 

> but if I put the message in a text variable in asp and had

> 

> Dim mytextvariable

> mytextvariable="this is my message"

> Response.write "<img src='mypic.gif' alt=" & mytextvariable & ">"

> 

>  it will only show the first letter of the message ie the word 'this'

but 

> not the rest of the message. Any ideas????

should be like this

 Dim mytextvariable

 mytextvariable="this is my message"

 Response.write "<img src='mypic.gif' alt='" & mytextvariable & "'>"








  Return to Index