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

stupid getElementById

I have a bunch of input elements which are DISABLED="true".
Based on certain actions I want to enable them using javascript.
It would be simple to just do this by accessing their names directly, unfortunately this page is a bit more complex. I have it split into DIVs and am making copious usage of style.display="none"....Also some of the names are common.
Only the element ID's are definetly unique.
What I am (basically) trying to do is simply:
Expand|Select|Wrap|Line Numbers
  1. var tbl_type_h = document.getElementById("tbl_type_h");
  2. tbl_type_h.disabled="false";
But the silly element is still disabled.
I am sure the function is firing and the correct value is being passed on down.
It would appear I am not using tbl_type_h correctly.

Thanks to you who can get me back on track!!!!!
Oct 28 '06 #1
9 1676
ronverdonk
4,258 Expert 4TB
You can't blame this on a stupid getElementById, because it is your own fault.
Question: what do you want to assign to your variable? Answer: the value of the element. Then code it like that:
[html]var tbl_type_h = document.getElementById("tbl_type_h").value;[/html]

Ronald :cool:
Oct 29 '06 #2
hehheh... thanks.
Oct 30 '06 #3
Darn - i had hoped it was that simple.
Unfortunately this is not the solution.
Consider i am actually trying to create an identifier to that page element.
Not nessecarily caring about the value of the input itself.
I am using getElementById successfully to control the display property with the syntax shown above - it's only when trying to access the DISABLED prop that I recieve unexpected results...
Oct 30 '06 #4
i just went through and made the input names unique.
Access it the old fashioned way.
Oct 30 '06 #5
i just went through and made the input names unique.
Access it the old fashioned way.
This raises new challenges...
Any other observartions are much appreciated.
Oct 30 '06 #6
Im going to try to accomplish my goal using the form elements index.
Oct 30 '06 #7
steven
143 100+
Give this a try:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById("tbl_type_h").disabled = "false";
Oct 30 '06 #8
I ended up giving the elements unique names and adding a hidden input with no value. Then when the user is navigating he forces value to the hidden input.
Which I then detect with vbscript and process the appropriate vars based on that value....

Which got me by and onto the next screen.
Oct 30 '06 #9
scripto
143 100+
Darkdirk

the correct statment should be:

var tbl_type_h = document.getElementById("tbl_type_h");
tbl_type_h.enabled=true;

no quotes on the true/false
Oct 30 '06 #10

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

Similar topics

3
by: harry | last post by:
Trying to get a function working in IE 5.5 (sp3) & Mozilla1.6 The function is called when a table row is double clicked i.e... function dblClicked() { getElement("viewSearch").click(); } ...
4
by: lawrence | last post by:
Can anyone tell me why this code works in Netscape 7.1 but not in IE??? <SCRIPT type='text/javascript'> function makeVisible(nameOfDiv) {...
6
by: @sh | last post by:
I know this is probably a real simple one, but I'm obviously missing something.. I'm building a function that I'll use throughout a website in the situation that I have two text boxes - the two...
4
by: dr1ft3r | last post by:
Hey guys, I'm building a site for a landscaping business down the street and can't seem to get part of the code functioning correctly. The code fails on line 68 where I make a reference to an...
2
by: lazukars | last post by:
I have been going over the this code for hours and am baffled. Am I missing something stupid? I am creating dynamic html via innerHTML for a webpage. There is an onClick function in this...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...

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.