Forum Moderators: open

Message Too Old, No Replies

Setting type on input fields doesnt work in IE 5.2 MAC

         

pepejeria

9:29 pm on Jan 16, 2004 (gmt 0)

10+ Year Member



The following doesnt work

<form name="oForm">
<input type="text" name="oInput">
</form>

document.forms["oForm"].oInput.type = "hidden";

I get this error that type is not settable. Is there anyway to achieve this somehow? Any workarounds?

/José Jeria

BlobFisk

12:54 am on Jan 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld, pepejeria

Apply an ID to the input:

<input type="text" id="myID">

Then, you JavaScript would be:

document.getElementById('myID').style.visibility='hidden';

HTH

pepejeria

9:57 am on Jan 18, 2004 (gmt 0)

10+ Year Member



Well, that is not the same as i want to do. I am creating something dynamically with the DOM. What i need is an input with type="hidden". To set this is in IE 5 MAC is impossible.
Changing the display to none or visibility to hidden brakes my script in IE 5 Win.

I solved this with a workaround using innerHTML. Thanks for your time and help though.

BlobFisk

2:09 pm on Jan 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Glad you got it working! ;)