Closed Thread Icon

Topic awaiting preservation: SPAN disabled=false not applying (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22245" title="Pages that link to Topic awaiting preservation: SPAN disabled=false not applying (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: SPAN disabled=false not applying <span class="small">(Page 1 of 1)</span>\

 
Virbatem
Nervous Wreck (II) Inmate

From: Perth Western Australia
Insane since: May 2004

posted posted 06-19-2004 21:16

msdn.microsoft.com specifies that a SPAN element has no disable attribute. But when you specify disabled=false the span is disabled. (obviously the same occurs when set to true.)


Programmatically setting the disbled value functions correctly. Does anyone have any suggestions?

code:
incorrect:
<span id=noGhost disabled=false>ghost me</span>


correct:
document.getElementbyId("noGhost").disabled=false;




Not Enough Is Better Than Too Much

Veneficuz
Paranoid (IV) Inmate

From: A graveyard of dreams
Insane since: Mar 2001

posted posted 06-19-2004 22:03

The msdn site is correct, the span-tag doesn't have a disable attribute... What do you want to accomplish?

_________________________
"There are 10 kinds of people; those who know binary, those who don't and those who start counting at zero"
- the Golden Ratio - Vim Tutorial -

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 06-19-2004 22:06

The "disabled" attribute (which is not a standard attribute) doesn't work by setting it to false or true. Rather, it's one of those attributes which, when included, takes effect, and when not, doesn't take effect. In HTML 4, they're meant to be used like this:

<tag disabled>

In XHTML, which requires all attributes to have values, they're meant to look like this:

<tag disabled="disabled">

If you want your span tag to be enabled, then don't include the disabled attribute.


 

Virbatem
Nervous Wreck (II) Inmate

From: Perth Western Australia
Insane since: May 2004

posted posted 06-19-2004 22:42

hmmm.


What am I trying to accomplish? There's a rather lengthy essay attached to that. As simply as I can: Each span creates a pretty custom button. Each is available depending on the state of data. The spans are created dynamically using a template in groups where usually one is active while the rest should be disabled until a data item is selected... etc...


I was looking for a cheap way to automate the default enabled/disabled state by hard coding it into the initially generated html for the span. While attempting to overcome the problem I enountered by using alternative flags it became apparant that I need a more sophisticated tracking method as knowing the original state of a span will not be sufficient due to actions the user may make.


This is going to be a rather large client database management application and the need for some early global automation should be employed to overcome creating a spcific function for each group of span/buttons. (yes I want to write it in javascript. No I will not take any alternative language suggestions)


Thanks for the confirmations.


Not Enough Is Better Than Too Much

Veneficuz
Paranoid (IV) Inmate

From: A graveyard of dreams
Insane since: Mar 2001

posted posted 06-20-2004 14:09

Why not use the 'display' property? It is standard comilant and works for all browsers. Set it to 'none' to remove the item and to 'block' or 'inline' to display the item. Since it is a standard CSS property it is also easy to manipulate using JavaScript...

_________________________
"There are 10 kinds of people; those who know binary, those who don't and those who start counting at zero"
- the Golden Ratio - Vim Tutorial -

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-20-2004 14:46

Another option you may take is to display a low opacity image ( or 2x2 dithered image ) above the SPANs you want to disable. Whatever you do, if you don't disable the form fields or links by a magical-non-standard property, you'll have to trap the onfocus events of the children element of the disabled SPANs to prevent advanced user from accessing active elements inside them.

Virbatem
Nervous Wreck (II) Inmate

From: Perth Western Australia
Insane since: May 2004

posted posted 06-20-2004 16:03

Thanks, all valid suggestions. There are a million ways to do it, images, display:none etc.... but the 'most' simple method for the current design is to have the disabled property in the HTML tag. Since that is not really suitable (having the effect of always disabling the span) I'll rewrite the logic and find another approach to initializing the spans enabled or disabled. Oh, and not displaying them serves no purpose. I merely want to show they are not able to be used at one moment or another. Also, removing them via no display does not solve the overall logical problems.


The aim of the exersize is to optimize 'every' line of code to it's minimal size right from the beginning. To paraphrase the mafia, take care of the commands and the program takes care of itself.


Not Enough Is Better Than Too Much

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 06-20-2004 16:15

To show that the active elements ( links, form fields ... ) are disabled, you could also decrease the opacity of their parent SPAN. I think your problem would have been a good entry for the May 20lines Javascript contest - Enhancing markup And, from the infos you gave, I think it could fit in the 20 lines constraint.

« BackwardsOnwards »

Show Forum Drop Down Menu