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
Solved

Changing the look and feel of a textbox

Posted on 2003-11-03
14
6,113 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress plugins not working in html 3 37
Insert Button on a table 16 36
return false must be hit after calling certain command 10 32
convert Systemjs to Webpack 3 25
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Find out what you should include to make the best professional email signature for your organization.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

809 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