473,796 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,1 00,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 2062


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,1 00,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.getEl ementById) {
area = document.getEle mentById('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,1 00,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.getEle mentById('area1 ').href

Jul 20 '05 #3

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

Similar topics

15
28959
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="..." value="..."> with <input type="submit" ...> the only name-value values submitted (pushed into the query string) is the one of the submit button that was pushed (if you have many of them). Ex:
61
24509
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 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
1
1721
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 it with DOM but sometimes the image map works and sometimes it doesn't. innerHTML
11
13726
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, there's an "Edit" link. So the page itself looks something like this: <HTML><HEAD><TITLE>blah</TITLE></HEAD><BODY> <!-- TEXT STARTS HERE --> <H1>Hello World!</H1> <P>More stuff here...</P>
14
5615
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 things). I note the document specifies that block level content can be included within a <map>. Testing this in order to discover why one might wish to do this, I find the block level content is rendered in page flow order anyway, and not...
5
1809
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: +-------------------+------------------+-------------------+ | Français | English | Deutsch | +-------------------+------------------+-------------------+ | Le tour du monde | Around the world | Die Reise um die | | en 80 jours | in 80 days ...
7
2752
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 tags will remain making the page safe (I have to convert the linefeeds to <BR>s because the Server.EncodeHTML does not do that it seems). The problem is that users can use a special tag when editing the top to specify an area of the tip that will...
6
31454
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 the HTML 4.01 specification I see this, too. What I'm wondering is - 'cols' & 'rows' determines the height & width of a textarea. So shouldn't that be something that is handled by CSS instead? What would be the practical consequence of leaving...
10
6469
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 MyObject<T: ChangeObject { ... public MyObject(string name, T value)
0
9679
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9527
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10453
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9050
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5573
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.