473,800 Members | 2,282 Online
Bytes | Software Development & Data Engineering Community
+ 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="JavaS cript" 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,28 7,92" HREF = "#"
OnClick="alert( alert_msg);retu rn false;"></a>
*************** *************** *************** ************
Can anybody point out the error of my ways?

Thanks
Dave

Jul 23 '05 #1
3 2020
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.c om 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="JavaS cript" 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,28 7,92" HREF = "#"
OnClick="alert (alert_msg);ret urn 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
1645
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; this.getName = function() { return this.name;
9
4924
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 fine from a link. The button does bring up the popup window, but when I press the links on the page, it doesn't return or close the window. ****************************************************************************
1
1416
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 System.Web.UI.WebControls or any ImageMap control on the Web Forms toolbox (just Image and Image Button). If I try pasting code such as below, .NET does not recognize the
9
2116
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 that the difference between what the ImageMap Control outputs and the html on the page I was trying to reproduce with ASP.NET 2.0 was the following: Handwritten HTML imagemaps (no whitestrip between them): <table>
7
3779
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 of the active areas hidden from users. I have a page named test.htm that includes a file get.php in a <scripttag that will dynamically generate some javascript to write the imagemap. The get.php file will write a unique key to a session that will...
1
2006
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 column and the with of the div (the div the ImageMap is included in). In the code below the column & div has Width of 300px and ImageMap has Width of 130, but when the page holding this GridView is displayed then the Width is 300 on the ImageMap. I...
1
25703
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 bad breath)? Scope describes the context in which a variable can be used. For example, if a variable's scope is a certain function, then that variable can only be used in that function. If you were to try to access that variable anywhere else in...
0
1461
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 page. I take a slice (from the middle) and use that as the background of a user control using the asp:panel control's backgroundURL property. <asp:Panel BackImageUrl="~//Images/K.gif" width="267" height="198" runat="server">
3
3435
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 have TinyImageB ( associated to an ImageMap1) The behavior desired is; When clicking on TinyImageB I want to replace BigImageA in ContentPlaceHolder1 with BigImageB The clicking of the ImageMap1 behaves correct it updates but to a new page with...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10505
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10253
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10035
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7580
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5471
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.