Solved

Changing the look and feel of a textbox

Posted on 2003-11-03
14
6,116 Views
Last Modified: 2010-04-09
Is there a way I can make a textbox have no borders and have the same color as the background. I cannot change it to a label since I have some javascript which runs on the client which changes the values inthe textbox without making a round trip to the server for updates.

I would appreciate some syntax if possible. Thanks
0
Comment
Question by:rian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 3
  • +2
14 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 100 total points
ID: 9673352
you mean something like this?

junk56.htm:<input type="text" style="BACKGROUND:#000000;COLOR:#FFFFFF;border-color:#000000;" value="" />
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 9673357
oops, remove the first part -- "junk56.htm:"
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9673361
Depending on the color of your background:

If it's white -
<input type="text" name="mytextbox" size="20" style="border:1px solid #FFFFFF;">
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

Expert Comment

by:knightEknight
ID: 9673377
... and ofcourse, give the input a name.
0
 

Author Comment

by:rian
ID: 9673379
Can I read a CSS file and read the values from there.
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9673392
Yes:

<style type="text/css">
<!--
input.mytext { border:1px solid #FFFFFF; }
//-->
</style>

<form>
<input type="text" name="mytextbox" size="20" class="mytext">
</form>
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9673407
>> and read the values from there.
I thought you were using JS for the values?
0
 

Author Comment

by:rian
ID: 9673441
No. I am using a CSS. I am using JS to update the value inside the text box based on other input changes.
  <LINK REL="stylesheet" TYPE="text/css" HREF="../include/m_style.css">

      <TR>
        <TD ALIGN="right" VALIGN="top"><DIV CLASS="clsTCAPTION">Spool Length:</DIV></TD>
        <TD ALIGN="left" VALIGN="top"><DIV CLASS="clsCONTENT"><INPUT TYPE="text" READONLY ID="SPLEN" NAME="SPLEN" VALUE="0" SIZE="10" > in</DIV></TD>
      </TR>
      <TR>

I tried changing the background color is the style sheet and it was still white in color inside the text box. Let me try again.
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9673533
You need to use the class attribute.

<INPUT TYPE="text" READONLY Class="SPLEN" ID="SPLEN" NAME="SPLEN" VALUE="0" SIZE="10" >

<style type="text/css">
<!--
input.SPLEN { background-color:#000000; border:1px solid #000000; }
//-->
</style>

0
 
LVL 11

Expert Comment

by:Zontar
ID: 9675368
No need to use nested divs there --

<td class="clsTCAPTION">...</td>

should do the same thing if your CSS is written correctly.
0
 
LVL 1

Expert Comment

by:dushpat
ID: 9677113
add this CSS in your page.


<head>
<style type="text/css">
<!--
.textbox { font-family:
Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color: #000000; border-style:
none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px;
background: transperant; border-left-width: 0px}
}
-->
</style>
</head>


<body>
<form>
<input  name="test" value="" type="text" size="14" class="textbox">
</form>
</body>
0
 
LVL 1

Expert Comment

by:dushpat
ID: 9691827
Hi rian

My answer is the best because with your accepted answer you can make textfield's background and border black.
and font color white.

but with my answer you can make background transperant and border is none(means border=0).
That is perfect for your requirement.

for that first you just define style sheet at top and apply it as class="textbox"

<head>
<style type="text/css">
<!--
.textbox { font-family:
Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color: #000000; border-style:
none; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px;
background: transperant; border-left-width: 0px}
}
-->
</style>
</head>


<body>
<form>
<input  name="test" value="" type="text" size="14" class="textbox">
</form>
</body>
0
 

Author Comment

by:rian
ID: 9691838
Dushpat, I do agree that your answer was the best.And I wish I can give you the credit. However, I had a time constraint to solve this problem and knight's answer solved my issue promptly. I do promise I will make it up with future questions. I am a novice in html.
0
 
LVL 31

Expert Comment

by:seanpowell
ID: 9693817
Just FYI, your style tag is much longer than it needs to be and you have an error in your code:

Assuming the fonts are set in higher level elements...

.textbox { border-style: none; background: transparent; }

Also, you need to spell transperant as transparent. Only IE will forgive the spelling mistake.

Thanks,
GM
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AJAX Wordpress Not Reading Variable 2 59
alert on input text 2 25
Can't get cursor to change 3 16
Making Table Thru ASP Response.write 5 21
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question