Solved

Changing the look and feel of a textbox

Posted on 2003-11-03
14
6,102 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
  • 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Do you want to insert HTML5 video into your site? This is the tutorial how to do so. What are the main advantages of HTML5 video? 1) Have good compression, good image quality, and low decode processor use. 2) It is royalty-free 3) It is easi…
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
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 embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now