Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Changing the look and feel of a textbox

Posted on 2003-11-03
14
Medium Priority
?
6,133 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 400 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
Technology Partners: 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…

596 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