Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > changing input.type error with IE

Reply
Thread Tools

changing input.type error with IE

 
 
Michael Winter
Guest
Posts: n/a
 
      10-14-2004
On Thu, 14 Oct 2004 17:49:53 +0100, vastaso <(E-Mail Removed)> wrote:

> Ciao, I have an hidden field and I want make it visible, setting its
> "type"


[snip]

> it works fine in Mozilla but fails in Internet Explorer 6.


Microsoft have taken the liberty of making the type property read-only[1].
It would be a better idea to hide the element when the document loads
using the style object, then making it visible later.

When the document loads:

var elemRef = ...;

if(elemRef && elemRef.style) {
elemRef.style.visibility = 'hidden'; // or .display = 'none';
}


When you want to show the element:

var elemRef = ...;

if(elemRef && elemRef.style) {
elemRef.style.visibility = ''; // or .display = '';
}

Hope that helps,
Mike


[1] Well, it can be written to once, but only it the element in question
has just been created with a document.createElement call.

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
 
Reply With Quote
 
 
 
 
vastaso
Guest
Posts: n/a
 
      10-14-2004
Ciao, I have an hidden field and I want make it visible, setting its "type"
to "text" from a popup window.
I'm using this code:
window.opener.document.forms['formInsegnamenti'].elements['giorni_1'].type
='text';

it works fine in Mozilla but fails in Internet Explorer 6.

Any ideas?
Thanks


 
Reply With Quote
 
 
 
 
vastaso
Guest
Posts: n/a
 
      10-14-2004

"Michael Winter" <(E-Mail Removed)> ha scritto nel messaggio
newspsfvao4fxx13kvk@atlantis...
> On Thu, 14 Oct 2004 17:49:53 +0100, vastaso <(E-Mail Removed)> wrote:
>
> When the document loads:
>
> var elemRef = ...;
>
> if(elemRef && elemRef.style) {
> elemRef.style.visibility = 'hidden'; // or .display = 'none';
> }
>
>
> When you want to show the element:
>
> var elemRef = ...;
>
> if(elemRef && elemRef.style) {
> elemRef.style.visibility = ''; // or .display = '';
> }
>
> Hope that helps,
> Mike


Oh YES! It helps!!
Thank you very much


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing style of the numbers in a CSS <ol> without changing the style of the <li> Aaron Beall HTML 2 09-14-2007 08:07 PM
<FAQENTRY>I'm changing my page but nothing is changing on the screen. Why?</FAQENTRY> VK Javascript 3 03-15-2007 04:59 PM
Format for changing type-ahead error sound? F*R*A*N*K_pa_nu_cc_i Firefox 1 12-09-2005 02:20 AM
changing file extension without changing filename jamy Computer Support 4 03-04-2005 01:03 AM
Difficulty in changing the Connection Server control path changing ... Samridhi Kumar Shukla ASP .Net 1 11-30-2003 02:31 AM



Advertisments