i have the following script to create an image, map and its areas
now adding the image to the div works fine, but when i try and append the map onto the image it returns a Unexpected call to method or property access JavaScript error. - personMap = document.createElement('map');
-
personMap.setAttribute('name', 'newmap');
-
personMap.setAttribute('id', 'newmap');
-
var hotspots = Default.GetHotSpotDetails(MapNo); (AJAX call)
-
for(var j=0; j < hotspots.value.length; j++)
-
{
-
var hs = hotspots.value[j].toString().split(':');
-
area = document.createElement('area');
-
area.setAttribute('id', j);
-
area.setAttribute('shape', 'rect');
-
var coords = hs[1]+','+ hs[2]+','+ hs[2]+','+ hs[1];
-
area.setAttribute('coords', coords);
-
area.setAttribute('href', "javascript:ShowUserPopup('+hs[3]+'|'+hs[1]+'|'+hs[2]+')");
-
area.setAttribute('title', hs[0]);
-
area.setAttribute('alt', hs[0]);
-
personMap.appendChild(area);
-
}
-
image = document.createElement('img');
-
image.setAttribute('src', 'PrinterMap.ashx?PhotoID=' + MapNo);
-
image.setAttribute('ismap', 'ismap');
-
image.setAttribute('useMap', '#newmap');
-
image.setAttribute('id', 'PersonImageMap');
-
image.appendChild(personMap); //error here
-
document.getElementById('imgDiv').appendChild(image);
3 1883 acoder 16,027
Recognized Expert Moderator MVP
The map is separate from the image - it's not a child of the image. Just append it to the div instead.
The map is separate from the image - it's not a child of the image. Just append it to the div instead.
cheers mate that worked. Im reading up on the use of anchors and image maps, i know the anchor object has shape and coords property, can one use an anchor instead of an area?
acoder 16,027
Recognized Expert Moderator MVP
cheers mate that worked. Im reading up on the use of anchors and image maps, i know the anchor object has shape and coords property, can one use an anchor instead of an area?
I'm not sure. You can use an area as an anchor by setting the href property - see this link.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Alan Wang |
last post by:
Hi There,
For asp.net 2.0, there is a new web control called imageMap. I am just
wondering if there is ONLINE imageMap editor in the market so that
programmer doesn't have to figure out the actual pixel coordinates of the
corners of my hot spots and enter them numerically.
Thanks in advanced
|
by: Gilgamesh |
last post by:
Hi,
I have some very limited knowledge of web development but I have an
imagemap in which I want to be able to display a small yellow circle at
certain pre-define locations. When the user moves over these circles, I
need to show a small pop-up with info regarding this label.
Here is my Page_Load method:
// These create the hotspots at predefined locations which I'll get
|
by: Rak |
last post by:
I am looking for a way to programatically change the .net version of the
virtual directory that I am creating within a aspx page.
As part of creating a new customer in my asp.net 2 application, it
automatically creates a virtual directory and configures it. I am using the
DirectoryServices.DirectoryEntry class in C# to do this. I am unable to set
the .Net version of the virtual directory from 1.1 to version 2. All searches
led me to the...
|
by: jediknight |
last post by:
Hi All,
I am very new to ASP.NET but have used c# for windows very much.
I would like to display an imagemap which has the background as the map
of a city centre and icons denoting important landmarks.
I would like to have some hotspots on these icons so when the user
clicks on them, I can show a little window with some information on it
about that site.
|
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>
| |
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...
|
by: William Main |
last post by:
I have the following code
ImageMap image1 = new ImageMap();
image1.Click += new ImageMapEventHandler(ImageMap_Click);
image1.HotSpotMode = HotSpotMode.PostBack;
image1.ImageUrl = "~/images/permacon/page2.png";
if (Percentage != 100.0)
{
image1.Width = Unit.Percentage(Percentage);
image1.Height = Unit.Percentage(Percentage);
|
by: imranabdulaziz |
last post by:
Hi all,
I am using asp.net and C# Visual studio 2005.
Let me explain the scenario. I have stored procedure which return very no of column based on condition. Becoz I have to show columnwise record I used datalist.
And becoz of query return different no of column based on condtion I created template class for design and itembinding at run time .
I manage to create template column() but confuse over how to bind data. As no of column...
|
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">
|
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...
|
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...
| |
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...
|
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,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |