473,465 Members | 2,123 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

JavaScript Alert problem in imagemap

Hello -

I'm having trouble with JavaScript alerts in an imagemap. The mapped
areas are cells in a table, and the alerts display info related to the
cell that is clicked. The problem is that, even though the source html
is correct, the alert messages that are displayed appear to be random,
i.e., the alert for row 10 appears when row 3 is clicked, etc. On some
long tables, the same alert message is displayed for (nearly) every row
even though the html contains the correct message for each row.

It looks like, among other things, perhaps the alert is not being
"cleared" consistently after after being invoked, and when the next row
is clicked the info from the preceding choice is displayed again.

I'm using
************************************************** *****
<script language="JavaScript" type="text/javascript">
<!--
var alert_msg = "";
alert_msg +="Line 1";
alert_msg +="\nLine 2";
alert_msg +="\nLine 3";
// -->
</script>

<area SHAPE+"RECT" COORDS="0,62,287,92" HREF = "#"
OnClick="alert(alert_msg);return false;"></a>
************************************************** *******
Can anybody point out the error of my ways?

Thanks
Dave

Jul 23 '05 #1
3 2001
As Rosanne RosannaDanna used to say, "...Never mind". I failed to index
the successive alert_msg's in the script, so each one was overwriting
the preceding one and they all wound up being the same. I changed var
alert_msg to var alert_msg & N, where N is incremented each time.
Problem solved.

Thanks anyway...
Dave

Jul 23 '05 #2
Lee
dg*****@erols.com said:

Hello -

I'm having trouble with JavaScript alerts in an imagemap. The mapped
areas are cells in a table, and the alerts display info related to the
cell that is clicked. The problem is that, even though the source html
is correct, the alert messages that are displayed appear to be random,
i.e., the alert for row 10 appears when row 3 is clicked, etc. On some
long tables, the same alert message is displayed for (nearly) every row
even though the html contains the correct message for each row.

It looks like, among other things, perhaps the alert is not being
"cleared" consistently after after being invoked, and when the next row
is clicked the info from the preceding choice is displayed again.

I'm using
************************************************* ******
<script language="JavaScript" type="text/javascript">
<!--
var alert_msg = "";
alert_msg +="Line 1";
alert_msg +="\nLine 2";
alert_msg +="\nLine 3";
// -->
</script>

<area SHAPE+"RECT" COORDS="0,62,287,92" HREF = "#"
OnClick="alert(alert_msg);return false;"></a>
************************************************* ********
Can anybody point out the error of my ways?


You haven't shown us anything that would make the alert message
different for different areas. Do different areas display different
variables?

Jul 23 '05 #3
Yes - the data to be displayed for each area is different, but since I
hadn't subscripted the alert message variable, when the page loaded it
was being processed from beginning to end so all of the messages
displayed the text of the last message processed. I changed it so each
successive message variable is different (msg1, msg2, msg3, etc.) and
this fixed the glitch.

Thanks
Dave

Jul 23 '05 #4

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

Similar topics

11
by: Vincent van Beveren | last post by:
Hi everyone, I have the following code using inheritence The important part is the function getName(). The result should alert 'John Doe': function First(name) { this.name = name; ...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
1
by: Mad Scientist Jr | last post by:
I found some info on creating an imagemap in .NET at http://msconline.maconstate.edu/Tutorials/ASPNET2/ASPNET05/aspnet05-04.aspx but in VS.NET I don't see any ImageMap object under...
9
by: Nathan Sokalski | last post by:
I am using ASP.NET 2.0's ImageMap Control to create 2 imagemaps, one directly below the other. When I do this a thin blank space appears between them. After several days of frustration I realized...
7
by: trey.bason | last post by:
I know everyone who uses javascript at some point tries to think of a way to hide it from curious users/hackers, so here goes my question. I am trying to display an image map and keep the coords...
1
by: Jeff | last post by:
ASP.NET 2.0 I've got problems with the Width of the ImageMap below. The problem is that the ImageMap's Width doesn't have any effect in my GridView, the width are determine by width of the...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
0
by: DamienS | last post by:
Hi, I have a situation where I have custom user controls 'cut out' of the background image of a master page. Basically, I've used photoshop to export a sliced image which is used in the master...
3
by: corinne david | last post by:
I am developping a wesite. I am new at it. I usually program scientific program. I am using ImageMap and circleHotSpot. In the ContentPlaceHolder1 I have BigImageA In the ContentPlaceHolder2 I...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.