473,320 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Off Topic: Width of text input box vs. password input box

cjl
I have the following HTML/CSS:

HTML:
<div id="stealth_form">
<form name="stealthme" action="" onSubmit="return
initializeSearch(this);">
<input type='password' name='query' size=16>
</form>
</div>

<div id="search_form">
<form name="searchme" action="" onSubmit="return
initializeSearch(this);">
<input type='text' name='query' size=16>
</form>
</div>

CSS:
#search_form
{
position: absolute;
top: 600px;
left: 210px;
height: 50px;
width: 300px;
background-color: rgb(70,70,70);
visibility: visible;
}

#stealth_form
{
position: absolute;
top: 600px;
left: 210px;
height: 50px;
width: 300px;
background-color: rgb(70,70,70);
visibility: hidden;
}

OK. I use javascript to dynamically set the visibility of #search_form
to 'hidden' and the visibility of #stealth_form to 'visible'. In
mozilla/firefox there is no visual difference. In IE the #stealth_form
input box is 1 pixel wider, and when the change occurs it catches the
users eye and looks strange.

Any ideas / workarounds? I know this is off topic for this group, but
most on this group know an awful lot about HTML / CSS, and I thought it
was worth a shot.

-CJL

Oct 30 '05 #1
7 2079
VK

cjl wrote:
I have the following HTML/CSS:

HTML:
<div id="stealth_form">
<form name="stealthme" action="" onSubmit="return
initializeSearch(this);">
<input type='password' name='query' size=16>
</form>
</div>

<div id="search_form">
<form name="searchme" action="" onSubmit="return
initializeSearch(this);">
<input type='text' name='query' size=16>
</form>
</div>

CSS:
#search_form
{
position: absolute;
top: 600px;
left: 210px;
height: 50px;
width: 300px;
background-color: rgb(70,70,70);
visibility: visible;
}

#stealth_form
{
position: absolute;
top: 600px;
left: 210px;
height: 50px;
width: 300px;
background-color: rgb(70,70,70);
visibility: hidden;
}

OK. I use javascript to dynamically set the visibility of #search_form
to 'hidden' and the visibility of #stealth_form to 'visible'. In
mozilla/firefox there is no visual difference. In IE the #stealth_form
input box is 1 pixel wider, and when the change occurs it catches the
users eye and looks strange.

Any ideas / workarounds? I know this is off topic for this group, but
most on this group know an awful lot about HTML / CSS, and I thought it
was worth a shot.

-CJL

Try <comp.infosystems.www.authoring.stylesheets> for LAF (look and
feel)issue help
But first assign different names to your two forms: it's a gross DOM
misuse.

Oct 30 '05 #2
cjl
VK:
Try <comp.infosystems.www.authoring.stylesheets> for LAF (look and
feel)issue help
Thanks, I will.
But first assign different names to your two forms: it's a gross DOM
misuse.


Even if they have different parents?

-CJL

Oct 30 '05 #3
VK wrote:
cjl wrote:
[...]
<form name="stealthme" action="" onSubmit="return
[...]
<form name="searchme" action="" onSubmit="return
initializeSearch(this);">
[...]
[...]
But first assign different names to your two forms:


They already have different names.
it's a gross DOM misuse.


Rubbish.
PointedEars
Oct 30 '05 #4
cjl wrote:
VK:
But first assign different names to your two forms: it's a gross DOM
misuse.


Even if they have different parents?


Ignore what VK had to say on the subject. He mistakenly referred to
your `form' elements. It seems to me that you took that as a reference
to the `input' elements since your forms are not named the same.

There is nothing wrong in naming form controls the same, not even if
they have the same parent `form' element; the element objects will
be properly represented in a HTMLCollection. However, it complicates
accessing the respective element objects via the DOM if the parent
`form' element is the same; so in this case, iff(!) not needed, it
should be avoided.
PointedEars
Oct 30 '05 #5
cjl
T 'PE' L:
There is nothing wrong in naming form controls the same, not even if
they have the same parent `form' element; the element objects will
be properly represented in a HTMLCollection. However, it complicates
accessing the respective element objects via the DOM if the parent
`form' element is the same; so in this case, iff(!) not needed, it
should be avoided.


I probably don't need to, but it does make my javascript easier to
write because the input from either form is run through the same
functions, sliced and diced, etc.

Any ideas about the original post?

-CJL

Oct 30 '05 #6
cjl

I found the answer through trial and error, though now it seems quite
obvious.

I was relying on the size attribute in the html tag of the input
element. I simply added a style="width:125px" to both tags and now
they are identical in IE.

Whew.

-CJL

Oct 30 '05 #7
cjl wrote:
T 'PE' L:


Proper attribution should help to quickly identify the author of the
quoted material. Therefore, using initials for it is counterproductive.
There is nothing wrong in naming form controls the same, not even if
they have the same parent `form' element; the element objects will
be properly represented in a HTMLCollection. However, it complicates
accessing the respective element objects via the DOM if the parent
`form' element is the same; so in this case, iff(!) not needed, it
should be avoided.


I probably don't need to, but it does make my javascript easier to
write because the input from either form is run through the same
functions, sliced and diced, etc.


The condition in my last sentence was "if the parent `form' element
is the same". Since that does not apply here, your approach will not
complicate matters.
PointedEars
Oct 30 '05 #8

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

Similar topics

2
by: Kai Grossjohann | last post by:
I would like to put a text input field (in the sense of <input type="text">) and an image next to each other, where I know the size in pixels of the image, and I know the total width in em. I...
8
by: BiNZGi | last post by:
Hi I have reduced the problem to this code: <form> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td><input type="text" style="width: 100%;" value="Lorem ipsum dolor...
17
by: Piers Lawson | last post by:
If the following is displayed in IE6 or FireFox, the text box forces the second DIV to expand beyond its 15em width. Is there a way to have the text box fit within the DIV (preferably without...
6
by: Joe Morrison | last post by:
By my reading of the HTML standard: http://www.w3.org/TR/REC-html40/struct/tables.html the HTML shown below should display the text "Enter password" with the input field immediately adjacent,...
2
by: Neil Zanella | last post by:
The W3C HTML standard sais the following concerning the HTML input element: <quote> size = cdata This attribute tells the user agent the initial width of the control. The width is given in...
0
by: cjl | last post by:
I have the following HTML/CSS: HTML: <div id="stealth_form"> <form name="stealthme" action="" onSubmit="return initializeSearch(this);"> <input type='password' name='query' size=16> </form>...
2
xNephilimx
by: xNephilimx | last post by:
Hi, there. I'm trying to separate as much as I can the display form the conten, say CSS from HTML, but I encountered a little compatibility issue... I'm trying to set the width in pixels of a...
2
by: xtian | last post by:
Hi, I have been having some trouble with getting a column to be a fixed width. I have a table with 11 columns, so it doesn't all fit in a normal browser window. One of the cells has a "?" and then...
34
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - What online resources are available? ----------------------------------------------------------------------- *...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.