Click to See Complete Forum and Search --> : Changing colors
New2Java
04-22-2005, 11:08 PM
I have a pretty dumb question. I recently added a scrolling text box to my webpage. However, the background color is white and the text is black. Can anyone please tell me if there is a way to change just those colors without affecting the rest of the webpage. I have played with bgColor, but that changes the entire page.
Any help thay you can give me would be greatly appreciated!!
Thanks.
You could add
style="background-color:#0000FF; color:#FF0000"
to the div containing the text.
Would have to see the code to be more specific
7stud
04-23-2005, 04:03 AM
You could add
style="background-color:#0000FF; color:#FF0000"
to the div containing the text.
Inline styles? And, putting the style in a <div> surrounding the textbox wouldn't work anyway.
Try this:
<html>
<head><title></title>
<style type="text/css">
<!--
.tbstyle{
background-color: blue;
color: white;
}
-->
</style>
<script type="text/javascript" language="javascript">
<!-- Hide from browsers without javascript
// End hiding -->
</script>
</head>
<body>
<form name="f" method="post" action="">
<input class="tbstyle" type="text" value="enter some stuff" />
<input type="radio" name="" />
<input type="checkbox" name="" />
</form>
</body>
</html>
I recently added a scrolling text box to my webpage
I did not assume in was an input as I don't often see a scrolling input textbox
And like I said
Would have to see the code to be more specific
Ness_du_Frat
04-23-2005, 07:11 AM
If you show us the code, we can try to help you. You can define any background color for a scroll box, but the way you define it has to match your scroll box's style.
A class would be the best way to do it, I think, since you can change it easily without having to change the page.
New2Java
04-23-2005, 09:51 AM
Sorry about not showing the code, but I know of some sites that especially do not permit code to be posted. Anyway, Here is the code as I received it:
PART 1
----------------------------------------------------------------
Copy the next line to the inside of the <body>
tag Immediately following the word body:
onunload="clearTimeout(scrollid)"
Example: <body onunload="clearTimeout(scrollid)" bgcolor=#80FFFF>
----------------------------------------------------------------
----------------------------------------------------------------
PART 2
This script goes where you wish the scroll box to appear:
<!--Begin Text Scroller Script-->
<SCRIPT>
function scroll(msg,ctrlwidth){
msg="---------------------------------"+msg
Mymsg=msg
while(Mymsg.length<ctrlwidth){Mymsg += msg}
document.write('<FORM NAME="Scroll">')
document.write('<CENTER><INPUT NAME="scroll" VALUE= "'+Mymsg+'" SIZE= '+ctrlwidth+'></CENTER>')
document.write('</FORM>')
var scrollid=null
rollmsg()
}
function rollmsg(){
MyMsg=document.Scroll.scroll.value
MyMsg=MyMsg.substring(1,MyMsg.length)+MyMsg.substring(0,1)
document.Scroll.scroll.value=MyMsg
scrollid=setTimeout("rollmsg()",300)
}
scrollid=setTimeout("rollmsg()",300)
</SCRIPT>
<script language='JavaScript'>
scroll("YOUR MESSAGE GOES HERE",50)
</script>
Being an old mainframe programmer, I can understand pretty much of the code. But not having any formal training in JavaScript, I do get lost. So any help I can get would be greatly appreciated.
Ness_du_Frat
04-23-2005, 09:54 AM
You can use 7Stud's code. It will work, I'm sure.
In this line here :
document.write('<CENTER><INPUT NAME="scroll" VALUE= "'+Mymsg+'" SIZE= '+ctrlwidth+'></CENTER>')
you put that :
document.write('<CENTER><INPUT NAME="scroll" VALUE= "'+Mymsg+'" SIZE= '+ctrlwidth+' CLASS="tbstyle"></CENTER>')
and then, in your style sheet ( you have a style sheet, right ? If you don't... I'll eat you !!!! lol !!! ) you put this :
.tbstyle{
background-color: blue;
color: white;
}
It'll set up the bgcolor, as well as the text color...
7Stud, I hope I explained it all right ? As it was your answer in the beginning...
New2Java
04-23-2005, 11:15 PM
You'll have to excuse me, but I must be really screwing something up. The following is how I added the code to the style sheet and the script and I still cannot get a color change. Can someone please tell me where I messed up this time???
<style type="text/css">
body {
scrollbar-arrow-color: #FFFFFF;
scrollbar-base-color: #54587E;
scrollbar-dark-shadow-color: #ECEBEA;
scrollbar-track-color: #E4E3EE;
}
<!--
.tbstyle {
background-color: #0000FF;
color: white
}
-->
</style>
------------------------------------------------------------
function scroll(msg,ctrlwidth){
msg="---------------------------------"+msg
Mymsg=msg
while(Mymsg.length<ctrlwidth){Mymsg += msg}
document.write('<FORM NAME="Scroll">')
document.write('<CENTER><INPUT NAME="scroll" VALUE= "'+Mymsg+'" SIZE= '+ctrlwidth+'class="tbstyle"></CENTER>')
document.write('</FORM>')
var scrollid=null
rollmsg()
}
(the rest of the script not shown)
You need a space between the single quote and class
ctrlwidth+' class="tbstyle">
New2Java
04-24-2005, 07:58 AM
That was it!! Thanks to all of you for all of your help and patience!!!!!