Using ImageMap and displaying circles on it

G

Gilgamesh

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
from the database
imageMap.Areas.Add(new ImageMapCircleArea("", new Point(100, 50), 12));
imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(139, 50), 41,
"XXXXXXXXXX"));

imageMap.Areas.Add(new ImageMapCircleArea("", new Point(200, 150),
12));
imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(200, 150),
41, "YYYYYYYYYY"));

imageMap.Areas.Add(new ImageMapCircleArea("", new Point(300, 250),
12));
imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(300, 250),
41, "ZZZZZZZZZZ"));

imageMap.Areas.Add(new ImageMapCircleArea("", new Point(400, 250),
12));
imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(400, 250),
41, "AAAAAAAAAA"));

imageMap.Areas.Add(new ImageMapCircleArea("", new Point(500, 250),
12));
imageMap.Areas.Add(new ImageMapCircleArea(null, new Point(500, 250),
41, "BBBBBBBBBBB"));

//
// HOW DO I ADD CIRCLES TO THE IMAGEMAP AT THIS POINT TO REPRESENT
// EACH OF THE ABOVE POINTS
//

// add the script called by the event handlers
StringBuilder script = new StringBuilder();
script.AppendFormat("<script language=\"javascript\">{0}",
Environment.NewLine);
script.AppendFormat("\tvar image1 = new Image(291, 112);{0}",
Environment.NewLine);
script.AppendFormat("\timage1.src = \"Bham Backdrop.JPG\";{0}",
Environment.NewLine);
script.AppendFormat("\tfunction DisplayImage(image) {0}{1}", "{",
Environment.NewLine);
script.AppendFormat("\t\tdocument.imageMap.src = image.src;{0}",
Environment.NewLine);
script.AppendFormat("\t\treturn true;{0}", Environment.NewLine);
script.AppendFormat("\t{0}{1}", "}", Environment.NewLine);
script.Append("</script>");

Page.RegisterClientScriptBlock("DisplayImage", script.ToString());
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top