473,503 Members | 12,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Equivalent of .disabled = false in Mozilla?

Hi

How do I accomplish the following functionality in Mozilla/ Firefox:

document.form.textbox.disabled = false

if I want to conditionally enable a text box that was disabled by default.

The above code works fine in IE, but doesn't in Mozilla. I have seen
somewhere the Mozilla equivalent of the same, but can't quite find it.

Also I would appreciate if you can point me to a solution (if any) that
works in both of them, without having to resort to checking the browsers
and executing seperate code.

Thanks in advance!
RI
Jul 23 '05 #1
6 5014

"Red_Indian" <re*******@liverpoolfans.com> ???????/???????? ? ????????
?????????: news:2g************@uni-berlin.de...
Hi

How do I accomplish the following functionality in Mozilla/ Firefox:

document.form.textbox.disabled = false

if I want to conditionally enable a text box that was disabled by default.

The above code works fine in IE, but doesn't in Mozilla. I have seen
somewhere the Mozilla equivalent of the same, but can't quite find it.

Also I would appreciate if you can point me to a solution (if any) that
works in both of them, without having to resort to checking the browsers
and executing seperate code.

Thanks in advance!
RI

I checked in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6)
Gecko/20040206 Firefox/0.8.
It works.
Here is piece of code.
<html>
<head>
<title>Test Page</title>
</head>
<form name="form123" id="form123" method="post">
<INPUT TYPE="text" NAME="catalog" SIZE="20">
<INPUT TYPE="button" NAME="button1" VALUE="disable"
onClick="form123.catalog.disabled=true">
<INPUT TYPE="button" NAME="button2" VALUE="enable"
onClick="form123.catalog.disabled=false">
</form>
</html>
Jul 23 '05 #2
In article <2g************@uni-berlin.de>, re*******@liverpoolfans.com
enlightened us with...
Hi

How do I accomplish the following functionality in Mozilla/ Firefox:

document.form.textbox.disabled = false


IIRC, standard cross-browser code would be

document.forms["formname"].elements["elementname"].disabled = false;
--
--
~kaeli~
Any sufficiently advanced technology is indistinguishable
from magic.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3
Dennis Biletsky wrote:
I checked in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6)
Gecko/20040206 Firefox/0.8.
It works.


My mistake!!

I asked the wrong question... :p

I want to know the equivalent of ".innerHTML" in Mozilla

e.g.

document.getElementById('label1').innerHTML = "Test"
/
/
...
<p id="label1">
When you look at my code you'll see why I made the mistake of asking the
"wrong question" - I didn't realize that maybe the condition wasn't
being satified in the first place.

if (document.getElementById('label1').innerHTML != '')
{
document.request.textbox.disabled=false
....
}

Thanks once again!
"RI"
;)
Jul 23 '05 #4
Red_Indian <re*******@liverpoolfans.com> writes:
I want to know the equivalent of ".innerHTML" in Mozilla
innerHTML works in Mozilla.
document.getElementById('label1').innerHTML = "Test"
/
/
...
<p id="label1">
I hope there is an </p> somewhere. Make sure your HTML is valid,
or that could be the cause of your problems.

Is the assignment happening before the <p> has been placed on the
page?
if (document.getElementById('label1').innerHTML != '')
There is nothing here that shoudln't work in Mozilla/Gecko.
{
document.request.textbox.disabled=false


This might work, but I would recommend:
document.forms['request'].elements['textbox'].disabled = false;

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #5
Lasse Reichstein Nielsen wrote:
Make sure your HTML is valid,
or that could be the cause of your problems.


That tip helped me identify the problem. I ran the validator (and
amongst the other things :D) I found I was doing this right BEFORE the
code I sent in my earlier mail:

function refresh()
{
req_type=document.getElementById('type').value
.....

}

for a control NAMED (not the id) "type" :

<select name="type" onchange="refresh()">

While IE was forgiving this mistake and "realizing" I "meant" this:

document.myform.type.value (I don't know why I didn't use this in the
first place!!)

Mozilla wasn't (and rightly so ofcourse)

Anyways, I planned to run the HTML validator "at the end" of my project,
but the lesson I have learnt is it's never to early to validate your
HTML code. I guess I should get one of those editors with a built in
validator ;)

Thanks Lasee and everybody else!
RI
Jul 23 '05 #6
DU
Lasse Reichstein Nielsen wrote:
Red_Indian <re*******@liverpoolfans.com> writes:

I want to know the equivalent of ".innerHTML" in Mozilla

innerHTML works in Mozilla.

document.getElementById('label1').innerHTML = "Test"
/
/
...
<p id="label1">


If the node to change is a text node, then innerHTML can be conveniently
replaced by W3C DOM 2 CharacterData attribute or a DOM Core attribtue
like assigning the childNodes[0].nodeValue; either way, such methods
which will work in Opera 7.x, MSIE 5+, Mozilla, Safari, etc..

DU
Jul 23 '05 #7

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

Similar topics

1
6201
by: David Wake | last post by:
I have two radio buttons and two checkboxes in a form. I'm trying to write some code so that when a radio button is selected, its corresponding checkbox is disabled. My code looks like this: ...
4
3179
by: Craig | last post by:
I have a page that has a few columns and totals. I've been asked to amke sure that not only is the totals boxes readonly, they must not accept focus from the cursor. However, setting the bo to...
7
26971
by: Mark Szlazak | last post by:
Is there anything for Mozilla or Firefox that would be equivalent to IE's onpaste event for a textarea?
14
3281
by: horos | last post by:
hey all, I'm a heavy perl user, not so much a java script user, and was wondering... perl has an extremely nice utility called Data::Dumper, which allows you to dump out the contents of an...
4
2488
by: Hai Nguyen | last post by:
I'm learning C sharp and do not like vb much. I'm creatiing a wepage using panel to test myself. I tried to use these code below, which is written in VB, and to transform them to c sharp but I got...
1
2550
by: Sebastian Feher | last post by:
Hi All, I am calling load() on a xml document object and I would like to test if there was any exception. Is there an equivalent to xmlDocument.parseError.reason in Mozilla/FF1.5+ ? So far...
11
2399
by: honey99 | last post by:
Hi! I have a combobox,it should be disabled when i select a value(say "post") from another combobox.it is working in IE but not in mozilla...can anybody help me??i'm sending the code.... Regards ...
2
1779
by: CreativeMind | last post by:
hi i have following code but problem is that when i debug both checkboxes have disabled property always false whether it is checked or unchecked..thx for help. function checkFinance(){ var...
1
1063
by: brettokumar | last post by:
hi i hav a button i set a property for this button Enabled ="False"; this button hav text and at all. while im run the application this button is disabled and the text is displayed in IE but...
0
7212
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,...
0
7098
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
7296
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,...
1
7017
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...
0
5604
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,...
0
4696
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...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
751
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
405
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.