473,395 Members | 1,941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

accessing <area> attributes in Mozilla?

I would like to be able to dynamically change the attributes of an <area>
element in an image map. The following works in IE 6 and Opera 7:

<map name="Map1">
<area shape="rect" coords="10,10,100,50" href="foo.html" id="area1">
</map>
....
<script>
document.area1.href = "bar.html";
</script>

but it doesn't work in Mozilla 1.4. I tried using name="area1", but that
didn't work either. Is there any way to referrence the attributes of an
<area> tag in Mozilla?

thanks,
Gabe
Jul 20 '05 #1
2 2017


Gabe Moothart wrote:
I would like to be able to dynamically change the attributes of an <area>
element in an image map. The following works in IE 6 and Opera 7:

<map name="Map1">
<area shape="rect" coords="10,10,100,50" href="foo.html" id="area1">
</map>
...
<script>
document.area1.href = "bar.html";
</script>

but it doesn't work in Mozilla 1.4. I tried using name="area1", but that
didn't work either. Is there any way to referrence the attributes of an
<area> tag in Mozilla?


You need to learn how to access an element with an id attribute set with
script:
var area;
if (document.getElementById) {
area = document.getElementById('area1');
if (area) {
area.href = 'bar.html';
}
}
That works with IE5+, Netscape 6+, Mozilla, Opera 7 and any other
browser implementing the W3C DOM Core and HTML

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2
Lee
Gabe Moothart said:

I would like to be able to dynamically change the attributes of an <area>
element in an image map. The following works in IE 6 and Opera 7:

<map name="Map1">
<area shape="rect" coords="10,10,100,50" href="foo.html" id="area1">
</map>
...
<script>
document.area1.href = "bar.html";
</script>

but it doesn't work in Mozilla 1.4. I tried using name="area1", but that
didn't work either. Is there any way to referrence the attributes of an
<area> tag in Mozilla?


The correct way to referrence it in any modern browser:
document.getElementById('area1').href

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Mattia | last post by:
Hi! I have a <form> that can be submitted thruogh three buttons and I need to tell witch one was pressed when the form was submitted. I now do it with 3 <input type="submit" name="..."...
61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
1
by: Brad | last post by:
I've been trying to set the content of a div tag with a image map for example <div name='ImageMapLayer'> <map> <area></area> </map> </div> I've tried using both innerHTML and DOM. I can set...
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
14
by: laurence | last post by:
I am implementing a comprehensive image-map generator utility, so have been studying W3C HTML 4.01 Specification (http://www.w3.org/TR/html4/struct/objects.html#h-13.6) on image maps (among other...
5
by: Garmt de Vries | last post by:
I have a table listing various translations of the titles of a set of books. Each row represents a book, each column represents a language. It looks like this: ...
7
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no...
6
by: Tony | last post by:
The w3schools HTML tag reference for <textarea> http://www.w3schools.com/tags/tag_textarea.asp says that the attributes 'cols' and 'rows' are REQUIRED attributes for the textarea tag. Looking at...
10
by: lpinho | last post by:
Hi all, I have a class (named for the example myObject) that can be of several types (int, string, float, etc), instead of using a object to define it's type I used a generic. public class...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.