469,925 Members | 1,482 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,925 developers. It's quick & easy.

Using ImageMap and displaying circles on it

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());

Jan 6 '06 #1
0 1405

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Alan Wang | last post: by
5 posts views Thread by pcnerd | last post: by
9 posts views Thread by Nathan Sokalski | last post: by
1 post views Thread by Jeff | last post: by
reply views Thread by William Main | last post: by
sanjib65
reply views Thread by sanjib65 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.