Visibility: crashing in javascript

I am using Ultrawebgrid for my application:

I am using a textbox to list errors in my application in a string template when a user clicks on that specific string ...

So I need to have texarea when there are any errors ..... otherwise when there are no errors, I don't even want the row_template to pop up ..... I am using IE6.

I am checking if there are any errors with javascript.so I had to use javascript event handler :: UltraWebGrid1_BeforeRowTemplateOpenHandler (gridName, rowId, templateId)

where I write the below statements: document.getElementById ("TextArea2"). Style.visibility = "collapse" inside the specified event function

1) it shows javascript error like Msgstr "Failed to get visibility property: Invalid argument" but no string pattern pops up ....... only error coming ....

2) Is there any code to lock the string pattern when there are no errors. i mean no pop_up with no errors

What's the solution for this ???

+1


a source to share


4 answers


DISPLAY

Use display instead of visibility. It does not take up space in the document.

document.getElementById("TextArea2").style.display = 'none';    // Turn off    
document.getElementById("TextArea2").style.display = 'inline';  // Turn on

      

VISIBILITY



document.getElementById("TextArea2").style.visibility="hidden";    // Turn off
document.getElementById("TextArea2").style.visibility="visible";    // Turn on

      

Using the code above, the text area will not be visible, but there will be white space in your document with the height and width of the text area.

Also the 'collapse' value is only supported in Internet Explorer 8

+5


a source


Try using:

document.getElementById("TextArea2").style.display = 'none';

      



and (to turn it back on)

document.getElementById("TextArea2").style.display = 'block'; // or 'inline'

      

+3


a source


Do you want to:

document.getElementById("TextArea2").style.visibility = "hidden";

      

"collapse" is not a valid value for the visibility property in IE6, as your error message indicates.

Alternatively, as suggested by @tvanoffsen, you can set the display property to "none". This has a slightly different effect: it does not take up space if set to a value "display: none"

, whereas setting "visibility: hidden"

still takes up space.

+1


a source


use the visible and hidden .style.visibility attribute instead of blocking and hiding. it works.

-1


a source







All Articles