473,396 Members | 1,866 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,396 software developers and data experts.

change style of cursor for textarea

Hi Folks,
I have a issue trying to change the cursor of area image map in run time, no static code, no id and no name.

the possibilities i have tried is

Expand|Select|Wrap|Line Numbers
  1. document.getElementsByTagName("area").style.cursor=hand;
  2. var cur=document.getElementsByTagName("area");
  3. cur..style.cursor=hand;
not working
-----------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. function winload()
  2. {
  3.  
  4. var areatg=document.getElementsByTagName("AREA");
  5. for(k=0;k<areatg.length;k++)
  6. {
  7. areatg[k].setAttribute("href","#");
  8. }
  9. }
  10. window.onload=winload;
this is working only one time onload only.

tried with setTimeout, setInterval onmouseover.

not working
-------------------------------------------------------------

Please send me your valuable useful suggestions As soon as possible

Cheers,
Dinesh
Jan 18 '08 #1
5 3262
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

first: please use a meaningful title for your thread and use code-tags when posting source-code ... read the posting guidelines

second: to your problem ... you could use the getElementsByTagName()-method but you should know, that this function returns a node-list (list of elements with the specified tagname) ... so you have to refer to the element with the correct index in the retrieved list. assuming you only have one textarea in your page you could use the following statement:

Expand|Select|Wrap|Line Numbers
  1. document.getElementsByTagName('textarea')[0].style.cursor = 'hand';
  2.  
kind regards
Jan 18 '08 #2
Thanks for replying to my issue. As per your suggestion, I have tried this but not working, can think for better solution.

Expand|Select|Wrap|Line Numbers
  1. function changeLink()
  2. {
  3. var arealen=document.getElementsByTagName('area');
  4. for(i=0;i<arealen.length;i++)
  5. {
  6. document.getElementsByTagName('area')[i].style.cursor = 'hand';
  7. }
  8. }
  9.  
cheers,
dinesh
Jan 19 '08 #3
gits
5,390 Expert Mod 4TB
Thanks for replying to my issue. As per your suggestion, I have tried this but not working, can think for better solution.

Expand|Select|Wrap|Line Numbers
  1. function changeLink()
  2. {
  3. var arealen=document.getElementsByTagName('area');
  4. for(i=0;i<arealen.length;i++)
  5. {
  6. document.getElementsByTagName('area')[i].style.cursor = 'hand';
  7. }
  8. }
  9.  
cheers,
dinesh
does that work? the tagName should be textarea ... isn't it? and it is a better idea to store the reference once you have retrieved the nodelist ... since all dom-methods are expensive in terms of runtime-performance ... so avoid it when possible:

Expand|Select|Wrap|Line Numbers
  1. function changeLink() {
  2.     var areas = document.getElementsByTagName('textarea');
  3.     var arealen = areas.length;
  4.  
  5.     for (i = 0; i < arealen; i++) {
  6.         areas[i].style.cursor = 'hand';
  7.     }
  8. }
kind regards

ps: in FF & mac i just tested the 'hand' cursor that didn't work while the 'pointer' cursor did :)
Jan 19 '08 #4
jerone
2
I'm having the same issue today.
The topicstarter does mean area (used for image maps).
Expand|Select|Wrap|Line Numbers
  1. areas = document.getElementsByTagName('area');
  2. for(var a=0;a<areas.length; a++){
  3.     areas[a].style.cursor = "help";
  4. }
I've tested it in FF and it works, but it doesn't work in Opera and IE.
Anyone got another solution.

gr J
Apr 1 '08 #5
pronerd
392 Expert 256MB
It is a better convention in JavaScript to use single quotes in JavaScript that double. How many area tags do you have in your page? Can you post the code from the page?
Apr 1 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Matt Adams | last post by:
As well known I could specify the text color in the body tag like: <BODY TEXT=WHITE LINK=WHITE VLINK=RED ALINK=WHITE> What I want to achieve now is that always (!) the text of the last visited...
3
by: Csaba2000 | last post by:
I have set onmousedown to change the cursor, but this setting is ignored (IE 5.5; NN 6.1 on Win 2K Pro) until the mouse is either moved or the mouse button is released. On Opera 7.01, the setting...
21
by: Michael Bierman | last post by:
Please forgive the simplicy of this question. I have the following code which attempts to determine the color of some text and set other text to match that color. It works fine in Firefox, but does...
3
by: Fluffy Convict | last post by:
I am trying to write a script that changes a textarea wrap realtime, basically like you can switch to and from "wordwrap" in Microsofts Notepad. Because of a bug...
4
by: TJS | last post by:
can the rows and columns of a textarea element with an id be changed on the fly ? if so is there an example ?
5
by: Simon Benson | last post by:
Probably a fairly simple problem but one that's been plaguing me for a couple of days... can anyone help? I have a classic ASP page with a number of text boxes which are updatable. For...
1
by: nikki.farrah | last post by:
Hi all, this is my first time posting so any help is appreciated! I am doing a simple AJAX request to our server, and I would like the cursor style changed to 'wait' when the user clicks a button...
6
by: vinniemac | last post by:
Using javascript, how can I change an attribute for ALL anchors (A:hover) on the webpage?
1
by: bibhukdas | last post by:
Hi All, Just to elaborate on the issue. The requirement is to handle this in javascript 1. User clicks on a button 2. Change the cursor style (We are using document.body.style.cursor="wait") 3....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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:
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.