Solved

Changing the look and feel of a textbox

Posted on 2003-11-03
14
6,121 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
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
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

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

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…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

687 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