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