473,782 Members | 2,531 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing input type in IE?

cjl
Hey all:

This code:

if (stealth)
{
document.search me.query.type = 'password';
}
else
{
document.search me.query.type = 'text';
}

works in FF but not in IE 6. It fails with "Error: Could not get the
type property. This command is not supported."

A previous post mentioned that in IE type is 'read only'.

Are there any work around for changing input type dynamically in IE?

Thanks in advance,
-CJL

Oct 18 '05 #1
5 2101
You can dynamically insert new "input" element with correct type before
"query", after that remove "query" element and rename added "input"
element to "query".

Or you can define to "input" elements: one with text type, other with
password type and dynamically disable incorrect element. Disabled
inputs don't posts to server.

Best, Ed.

cjl писал(а):
Hey all:

This code:

if (stealth)
{
document.search me.query.type = 'password';
}
else
{
document.search me.query.type = 'text';
}

works in FF but not in IE 6. It fails with "Error: Could not get the
type property. This command is not supported."

A previous post mentioned that in IE type is 'read only'.

Are there any work around for changing input type dynamically in IE?

Thanks in advance,
-CJL


Oct 18 '05 #2

cjl wrote:
Are there any work around for changing input type dynamically in IE?


You can create a new input with
var input = document.create Element('input' )
and set the type on that, then swap the elements with e.g.
oldInput.parent Node.replaceChi ld(input, oldInput);
--

Martin Honnen
http://JavaScript.FAQTs.com/
Oct 18 '05 #3

Martin Honnen wrote:
cjl wrote:
Are there any work around for changing input type dynamically in IE?


You can create a new input with
var input = document.create Element('input' )
and set the type on that, then swap the elements with e.g.
oldInput.parent Node.replaceChi ld(input, oldInput);


cjl,

In addition to what Martin wrote, after you create the "input" element,
you can only set the type once (in IE). If you try to set the type
again, then you'll get the error message again.

Oct 18 '05 #4
cjl
Hey all:

Thank you to all who replied.
Martin Honnen wrote:
In addition to what Martin wrote, after you create the "input" element,
you can only set the type once (in IE). If you try to set the type
again, then you'll get the error message again.


All of this makes me not want to support IE, which up until this point
I have been making compromises to do.

My users need to be able to swap between stealth mode and normal mode,
so I guess I could have two input text boxes, and show or hide them
dynamically based on what mode they choose, but then I would have to
copy the text input from one to another to make it seamless.

This is getting complicated.

Thanks again,
CJL

Oct 18 '05 #5
cjl <cj****@gmail.c om> wrote:
All of this makes me not want to support IE, which up until this point
I have been making compromises to do. This is getting complicated.


Cross-browser scripting is inherently complicated. Not supporting IE
doesn't strike me as a viable option.

--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cybers pace.org | don't, I need to know. Flames welcome.
Oct 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2533
by: Michel | last post by:
Hi folks, I wonder if what I have in mind is possible, maybe even not all that complicated: I have an image, which is a yellow circle. I want this yellow circle to change color by having 3 sliders (RGB) on a website and a button to process it. Is this at all possible and could someone point me in the right direction or
5
1669
by: martin | last post by:
I needed a way to display calculated, multiple, changing values (numerical sums) as users interacted with the page, and do this without going back to the server to load the page again. What I finally settled on was <input type=button...> without an "onClick" attribute (because the purpose of the buttons was only for displaying values). It works fine except they look and act like buttons. No big deal, but is there a better way?
1
3436
by: MickG | last post by:
I am trying to change the value of the variable "hard" according to which radio button is pressed and I am having no joy. Could anyone help me with this, the problematic section is marked with ***********************, I've included all the code incase that isn't where the problem is. Any help would be hugely appreciated. Mick
13
3030
by: amykimber | last post by:
Hi all, I know I'm doign something really daft, but I can't get this to work... I have a form with a bunch of inputs called ship_owner - why the ? Because I'm submitting this page though php and the put the data into an array in the post.... anywhat. I have a link <a href="javascript:change_class()" >Block mode</a> to
1
4533
by: rbinington | last post by:
Hi, I am trying to write a DNN module that has the ability to insert articles into an article repository. I want the users to be able to move pages around and enter text into the FCKEditor. I want only one instance of the FCKEditor on the screen at one time so I make tabs that the user can click and I store the values in variables behind the scenes. I change the CSS class on the link that is the currently selected one. I have a really...
1
2652
by: peck2000 | last post by:
Related to my earleir post ... this is the same project to re-purpose the Classifieds application in BEGINNING ASP 3.0 (Wrox) to a comicbook database ... This is a brainteaser that should have been easy to resolve but just doesn't seem to work for me ... The original application includes a form page for editing the details of an "item". In my case the item is a comicbook. The page functions just fine as long as I stick with text fields, but I...
4
3971
tolkienarda
by: tolkienarda | last post by:
hi all I am working on a php driven database program for a literacy program, it will allow them to keep track of classes and students, the part i am strugling with is adding new classes, the add_class page looks like: <body> ADD CLASS<br> Class Title: <input type="text" value="class_title"><br> Class Name: <input type="text" value="class_name">(Must be Unique)<br> <input type="checkbox" name="children" value="children">Children's...
8
5150
by: mike_solomon | last post by:
I have a button <input type="submit" name="Delete" value="Delete"> This code can not be changed I want to use Javascript to change the type I tried:
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9479
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10311
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8967
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5509
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.