|
#1
|
|||
|
|||
|
Hello. I'm looking for some help. I'm not really a javascript guy, so I really don't know what I need to do to get this to work. I've searched these forums and google and cannot find the answer to my problems.
So some background information. I'm working on a WHM hosting account managment system, and I have a few pages where there are rather large lists (HTML select lists) of account names that various things are done with the accounts once selected. Since the lists are so large, I have made a "Find Me" box that when a user types a character/string into the html input it "finds" the closest match in the select list and highlights it. That works find though, so that I'm not worried about. The problem is that I have a little image that when clicked it "unhides" two table cells set to "display: none" with CSS. This works fine in Firefox, but I cannot get it to work in IE. I get the error: "Could not get the display property. Invalid Argument." when I click the image in IE. I know the error pretty much tells me what is wrong in most cases, but I don't understand what I need to do to get it working. Here is the function I have: Code:
function hider() {
var hidden1 = document.getElementById("hidden1");
var hidden2 = document.getElementById("hidden2");
if (hidden1.style.display == 'none') {
hidden1.style.display = 'table-cell';
hidden2.style.display = 'table-cell';
}
else {
hidden1.style.display = 'none';
hidden2.style.display = 'none';
}
}
Code:
... <tr> <td id="hidden1" name="hidden1" style="display: none;"><span class="bold">Find Me:</span></td> <td id="hidden2" name="hidden2" style="display: none;"><input size="20" type="text" name="findme" onKeyUp="matchZone();"></td> </tr> ... If anyone could give me a few pointers and help me get this sorted out it would be quite nice and I would appreciate it. Thank you for your time, -Nedren |
|
#2
|
|||
|
|||
|
Quote:
When dealing with inline style sheet declarations, this issue is relatively simple to avoid: hide an element by assigning the string, 'none', and reveal it by assigning an empty string (''). This latter value effectively removes the declaration, so the browser will fall back to the value applied via a style sheet. It should be noted that when an element is hidden using a document-wide style sheet, this technique cannot be used, and life can become much harder. However, (on the Web, at least) if an element is to be revealed using a client-side script, it should be hidden by one. In that way, functionality will not be lost should the user be unable to show the missing content. Mike |
|
#3
|
|||
|
|||
|
Thank you very much for that explanation.
One quick question though, do you know how I can alter the elements "display" property with javascript in IE? |
|
#4
|
|||
|
|||
|
Quote:
Code:
function hider() {
var label, control;
if(document.getElementById && (label = document.getElementById('hidden1'))
&& (control = document.getElementById('hidden2'))
&& label.style && control.style)
{
label.style.display = control.style.display
= ('none' == label.style.display) ? '' : 'none';
}
}
|
|
#5
|
|||
|
|||
|
Quote:
Thank you a lot man. For both the actual function, and the indepth response answering my question/problem. |
|
#6
|
|||
|
|||
|
The explanation as well as examples are very helpful. My boss will be happy. Thank you very much!
|
|
#7
|
|||
|
|||
|
this thread was from 2005... we appreciate you looking into old threads to solve your problem but please don't revive threads that are old unless you do not understand something
__________________
This is a forum system not a PM system for questions. please treat it appropriately |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|