User1006193418 posted
I have a map of the us that is broken into an html image map. (not asp). What I'm wondering is it possible to get the title of the refering link on the map?
Hi,
Based on my understanding, you need to fetch the links as contacts.html, products.html and new.html from the code above in your post. So, I suggest you using Regular Expression to make it.
Please refer to this demo to see if it meets your requirement.
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
string s = @"<MAP NAME=""map1"">
<AREA
HREF=""contacts.html"" ALT=""Contacts"" TITLE=""Contacts""
SHAPE=RECT COORDS=""6,116,97,184"">
<AREA
HREF=""products.html"" ALT=""Products"" TITLE=""Products""
SHAPE=CIRCLE COORDS=""251,143,47"">
<AREA
HREF=""new.html"" ALT=""New!"" TITLE=""New!""
SHAPE=POLY COORDS=""150,217, 190,257, 150,297,110,257"">
</MAP>";
Regex r = new Regex(@"HREF=""(\w+).html""");
foreach (Match m in r.Matches(s))
{
Response.Write(m.Groups[1].ToString() + "<br />");
}
Response.Write("<br />");
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Best Regards,
Shengqing Yang