changing input.type error with IE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • vastaso

    changing input.type error with IE

    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.d ocument.forms['formInsegnamen ti'].elements['giorni_1'].type
    ='text';

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

    Any ideas?
    Thanks


  • Michael Winter

    #2
    Re: changing input.type error with IE

    On Thu, 14 Oct 2004 17:49:53 +0100, vastaso <vastaso@hjjh.i t> wrote:
    [color=blue]
    > Ciao, I have an hidden field and I want make it visible, setting its
    > "type"[/color]

    [snip]
    [color=blue]
    > it works fine in Mozilla but fails in Internet Explorer 6.[/color]

    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.v isibility = 'hidden'; // or .display = 'none';
    }


    When you want to show the element:

    var elemRef = ...;

    if(elemRef && elemRef.style) {
    elemRef.style.v isibility = ''; // 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.create Element call.

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    • vastaso

      #3
      Re: changing input.type error with IE


      "Michael Winter" <M.Winter@bluey onder.co.invali d> ha scritto nel messaggio
      news:opsfvao4fx x13kvk@atlantis ...[color=blue]
      > On Thu, 14 Oct 2004 17:49:53 +0100, vastaso <vastaso@hjjh.i t> wrote:
      >
      > When the document loads:
      >
      > var elemRef = ...;
      >
      > if(elemRef && elemRef.style) {
      > elemRef.style.v isibility = 'hidden'; // or .display = 'none';
      > }
      >
      >
      > When you want to show the element:
      >
      > var elemRef = ...;
      >
      > if(elemRef && elemRef.style) {
      > elemRef.style.v isibility = ''; // or .display = '';
      > }
      >
      > Hope that helps,
      > Mike[/color]

      Oh YES! It helps!!
      Thank you very much


      Comment

      Working...