PDA

View Full Version : Can't get font color to change for IE


Frank Bretz
09-30-2002, 03:31 AM
I can get the font color to change for Netscape but I can't find where to change the font color for IE. So font in Netscape shows up red but shows up black if you view document using IE.

The page I am talking about can be found at:
http://www.undeleteit.com//expandingText4.htm


I got the code from:
http://javascript.internet.com/scrolls/expanding-text.html

Thank you for your help.

whammy
09-30-2002, 03:48 AM
The relevant line of code is this:

size = "<font color=red point-size='"+x+"pt'>";

Which in the script you posted is contained within this section:


if(navigator.appName == "Netscape") {
size = "<font color=red point-size='"+x+"pt'>";
// blah blah blah more stuff
}


If you want the font color to work with both browsers you'll need to move that line out of that script section, and perhaps name it something besides "size" which makes no sense - perhaps the variable "fontproperties" would be more appropriate.

You'd also need to include that "size" or "fontproperties" variable in the same place in the IE scripting as it is in the NS scripting in order for it to work.

Hope this helps! :)

Frank Bretz
09-30-2002, 01:58 PM
That took care of the color problem. Now, as before only in IE only, as the text expands it moves the contents of the page down and as it contracts it pulls the contents back up.

Catman
09-30-2002, 04:52 PM
Are you holding down the control key when you rotate the mouse wheel? If so, that's the cause.

Frank Bretz
09-30-2002, 05:07 PM
Everything under the text that the java script puts on the screen goes down as the text expands and then goes back up as the text shrinks. This happens all on its own with out me touching anything. And this only happens if you view it using IE, everything stays where it supposed to when you view it using Netscape.

Here is the location of the site that is doing this.
http://www.undeleteit.com//expandingText4.htm

adios
09-30-2002, 05:20 PM
Noting unusual there - the element gets bigger, so the page's layout is re-jiggered to reflect that. Newer browsers readjust like that (NS4 isn't new). I'd try and fix it for you but, gee, it's a pretty bad script, hardly worth the trouble. Why not use something more sophisticated?

Frank Bretz
09-30-2002, 05:32 PM
Where can I get somthing better that does somthing close to what this coded is doing?

Mr J
09-30-2002, 06:52 PM
You could try increasing the height of your "box" to take into account the incease

adios
09-30-2002, 07:03 PM
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<base href="http://www.undeleteit.com/">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
<style type="text/css">
<!--

#tickertape {
position: relative;
background-color: black;
layer-background-color: black;
width: 400px;
height: 12px;
}

#subtickertape {
background-color: black;
layer-background-color: black;
position: absolute;
border: 1px solid black;
width: 400px;
height: 12px;
left: 0px;
top: 0px;
text-align: center;
}

.subtickertapefont {
font: bold 24px Verdana;
text-decoration: none;
color: red;
}

.subtickertapefont a {
color: white;
text-decoration: none;
}
-->
</style>
<style type="text/javascript">
document.ids.subtickertape.left='60px';
</style>
</head>
<body background="digital.gif"
onload="if (document.all||document.layers) {regenerate2();update()}">
<div align="center">
<img SRC="Forinsics2.gif" ALT="Clayton Hoskinson" height=200 width=762>
<table width="400" border="0"><tr><td>
<div id="tickertape">
<div id="subtickertape" class="subtickertapefont"></div></div>
</td></tr></table>
<script language="JavaScript1.2">

/*
Fading Ticker Tape Script-
© Dynamic Drive (www.dynamicdrive.com)
Fading background color component by Dave Methvin, Windows Magazine
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
//default speed is 4.5 seconds, Change that as desired
var speed=4500

var news=new Array()
news[0]="&amp;#149; Digital Evidence &amp;#149;"
news[1]="&amp;#149; Forensic Software &amp;#149;"
news[2]="&amp;#149; Forensic Hardware &amp;#149;"
//expand or shorten this list of messages as desired

i=0
if (document.all)
tickerobject=document.all.subtickertape.style
else
tickerobject=document.tickertape.document
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers)
setTimeout("window.onresize=regenerate",450)
}

function update(){
BgFade(0xff,0xff,0xff, 0x00,0x00,0x00,10);
if (document.layers){
document.tickertape.document.subtickertape.document.write('<span class="subtickertapefont">'+news[i]+'</span>')
document.tickertape.document.subtickertape.document.close()
}
else
document.all.subtickertape.innerHTML=news[i]

if (i<news.length-1)
i++
else
i=0
setTimeout("update()",speed)
}

function BgFade(red1, grn1, blu1, red2,
grn2, blu2, steps) {
sred = red1; sgrn = grn1; sblu = blu1;
ered = red2; egrn = grn2; eblu = blu2;
inc = steps;
step = 0;
RunFader();
}
function RunFader() {
var epct = step/inc;
var spct = 1 - epct;
if (document.layers)
tickerobject.bgColor =
Math.floor(sred * spct + ered *
epct)*256*256 +
Math.floor(sgrn * spct + egrn * epct)*256 +
Math.floor(sblu * spct + eblu * epct);
else
tickerobject.backgroundColor=
Math.floor(sred * spct + ered *
epct)*256*256 +
Math.floor(sgrn * spct + egrn * epct)*256 +
Math.floor(sblu * spct + eblu * epct);
if ( step < inc ) {
setTimeout('RunFader()',50);
}
step++;
}

</script>
<br>&amp;nbsp;<font size=-2></font>

<font color="#FFFFFF"><font size=+3>Computer Forensics : </font><font size=+1>Explantion
of computer forensics and why they need your help.</font></font>
<h1>
<font color="#FFFFFF">Digital Evidence -</font></h1>

<h1>
<font color="#FFFFFF">Forensic Software -</font></h1>

<h1>
<font color="#FFFFFF">Forensic Hardware -</font></h1>

<h1>
<font color="#FFFFFF">Litigation Support -</font></h1>

<h1>
<font color="#FFFFFF">Computer Crime -</font></h1>

<h1>
<font color="#FFFFFF">Network Risk Assessments -</font></h1>

<h1>
<font color="#FFFFFF">Penetration Testing -</font></h1>

<h1>
<font color="#FFFFFF">Pen-Tests -</font></h1>

<h1>
<font color="#FFFFFF">Third Party Review -</font></h1>

<h1>
<font color="#FFFFFF">Network Forensics -</font></h1>
</div>
</body>
</html>


Nice little DD script. The NS4 centering (using JSStyleSheets) is a hack; this needs to be done programmatically, for every text string, but I'm so tired of that browser...anyway, see if you're interested. Other scrollers on that site.

http://dynamicdrive.com/dynamicindex2/tickertape.htm

Frank Bretz
09-30-2002, 07:37 PM
I created a table to put the text into. And that fixed the moving up and down problem in IE. The code is running centered and fine in IE now. But now the text is no longer certered in Netscape, it is showing up in the upper left corner.

What do I need to do to get it to be centered in netscape again, like it is if you view it in IE. It is not even displaying in the table that it showes up in in IE

The new page that I am working with now is:
http://www.undeleteit.com//expandingText7.htm