473,324 Members | 2,456 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

border properties...

hey all,

i have this line of code:

document.getElementById("MESSAGE").innerHTML = total + " out of 24";

total is a variable that calculates the number of characters typed into a field. i need to have a red box appear around the total + " out of 24" if the total is > 24. here's what i have so far:

if ( total > 24 )
{
document.getElementById("MESSAGE").innerHTML = "<span style='border: 1px solid red; padding: .5em>" total + " out of 24</span>";
}
else
{
document.getElementById("MESSAGE").innerHTML = total + " out of 24";
}

this is obviously wrong because when the page loads i lose the "total out of 24" entirely. i'm pretty sure i'm just having syntax issues, but please advise!!

thanks...
Dec 7 '06 #1
4 1509
scripto
143 100+
If "MESSAGE" is a TextBox that could be the problem. Instead of a Texbox, try using a <DIV> - that will handle the innerHTML
Dec 7 '06 #2
If "MESSAGE" is a TextBox that could be the problem. Instead of a Texbox, try using a <DIV> - that will handle the innerHTML
it actually is a div: <div id="message"><div>
Dec 8 '06 #3
scripto
143 100+
then here you go - this seems to work well

document.getElementById("message").innerHTML = total + " out of 24";
document.getElementById("message").style.border="1 px solid red";
document.getElementById("message").style.padding=" .5em";
Dec 8 '06 #4
then here you go - this seems to work well

document.getElementById("message").innerHTML = total + " out of 24";
document.getElementById("message").style.border="1 px solid red";
document.getElementById("message").style.padding=" .5em";
worked like a dream. thanks!
Dec 8 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

33
by: Thomas Mlynarczyk | last post by:
Hi, I'm looking for a way to put a 1px solid border around the image in this link: <a href="some.html"><img src="some.gif"></a> Well, that, by itself, is simple. However, I would like to have a...
5
by: Headless | last post by:
The following code renders a visible border around the hyperlinked image using the UA's default colours for links in IE and Moz: a img{border-width:1px} <a href="foobar.html"><img...
7
by: Marek Mänd | last post by:
When using <TABLE rules="all"> Mozilla 1.6 and previous versions draw a nasty interiour border, which doesnt go away though I have on TD's css border:none set. Is it something wrong with my...
14
by: Sheila King | last post by:
Hello, Am at my wits end, after spending quite a bit of time looking at online CSS docs, reading FAQs, searching this newsgroup and validating my CSS document. Was trying to copy, to some...
5
by: Rolf Brauser | last post by:
Hi, I want to have a table with a border of 1px arround it but table="1" is more than a pixel because this 3d effect is attached. Values below are not accepted How can I get this border with...
5
by: Tamir Khason | last post by:
How be able to manage more deeply UI of TabControl and TabPage For example - I want to manage border color, change color of TabPage reef, eliminate spaces from both sides of the reef, so I bould...
2
by: C.McCullough | last post by:
It appears that the multiline and border properties of a tab control in the IDE on Visual Studio .Net 2003 are broken. I wanted to set the multiline property of my tab control to true to enable...
31
by: jcrouse | last post by:
Is there a quick and easy way to change the color of a label controls border from the default black to white? Thank you, John
5
by: DiGEnig | last post by:
ok here's my problem my markup is Xhtml strict so i am unable to place border="0" in my img tag. I want to be able to get rid of this border but have been un able to figure out how to do thi with...
1
by: Arpan | last post by:
The output of a DataGrid is nothing but a HTML table. To color or change the width of the outer 4 borders of a DataGrid, one can use the properties "BorderColor" & "BorderWidth" respectively but...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.