|
-
Oct 30th, 2001, 04:22 PM
#1
Thread Starter
Frenzied Member
javascript equivelent of SIZE="-1" ???(resolved)
I am trying to modify a page that is currently created by the server using a proprietary scripting language. I am changing it so that it will now be created on the client side using javascript.
At certain times, I want to adjust the font size. The html created by the server contains font tags such as: <FONT FACE="arial" SIZE="-1">.
I am trying to use fontSizeAdjust to no avail. For example: newRow.style.fontSizeAdjust = "-1". Am I on the right path, or should I be doing something else?
Last edited by ccoder; Oct 31st, 2001 at 10:20 AM.
-
Oct 30th, 2001, 04:28 PM
#2
PowerPoster
if the size created by the server is "-1" and you are changing it to "-1" it won't do anything.
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Oct 30th, 2001, 05:37 PM
#3
Thread Starter
Frenzied Member
Apparently I didn't explain myself very clearly.
The form in question contains nothing more than a table. In the old version, the scripting language builds the html for the table (including the afore mentioned <FONT> tag).
Example of script generated html code for the table body:
Code:
<TBODY>
<TR VALIGN=CENTER BGCOLOR=WHITE>
<TD ALIGN=LEFT BGCOLOR="RED">
<FONT FACE="arial" SIZE="-1">
 10.0.0.242
</TD>
<TD ALIGN=RIGHT>
<FONT FACE="arial" SIZE="-1">
0 of 269  
</TD>
<TD ALIGN=RIGHT>
<FONT FACE="arial" SIZE="-1">
4  
</TD>
<TD ALIGN=RIGHT>
<FONT FACE="arial" SIZE="-1">
28  
</TD>
<TD ALIGN=RIGHT>
<FONT FACE="arial" SIZE="-1">
5  
</TD>
<TD ALIGN=RIGHT>
<FONT FACE="arial" SIZE="-1">
85  
</TD>
<TD ALIGN=RIGHT>
<FONT FACE="arial" SIZE="-1">
5  
</TD>
<TD ALIGN=RIGHT>
<FONT FACE="arial" SIZE="-1">
242  
</TD>
</TR>
// etc., etc.
</TBODY>
I am now using javascript to build the table. I am trying to duplicate the <FONT FACE="arial" SIZE="-1"> in javascript.
Example of javascript code to create the table body. The value for td_size that is computed in function init is used in function insertTableRow in the statement newRow.style.fontSizeAdjust = td_size
Code:
function init()
{
theTable = (document.all) ? document.all.statstable :
document.getElementById("statstable")
theTableBody = theTable.tBodies[0]
if (screen.width == 800)
{
hd_size = "-1"
td_size = "-2"
}
else
{
hd_size = "-1"
td_size = "-1"
}
}
function insertTableRow()
{
var newCell
var newRow = theTableBody.insertRow(-1)
//debugger
newRow.style.textAlign = "RIGHT"
newRow.style.fontFamily = "ARIAL"
newRow.style.fontSizeAdjust = td_size
for (var i = 0; i < THData.length; i++)
{
newCell = newRow.insertCell(i)
switch (i)
{
case 0:
newCell.innerHTML = "  " + cellIP
newCell.style.backgroundColor = cellBG
newCell.style.textAlign = "LEFT"
break
case 1:
newCell.innerHTML = cellTO + " of " +
document.all.sample_count.value + "  "
break
case 2:
newCell.innerHTML = cellBMin + "  "
break
case 3:
newCell.innerHTML = cellWMin + "  "
break
case 4:
newCell.innerHTML = cellBAvg + "  "
break
case 5:
newCell.innerHTML = cellWAvg + "  "
break
case 6:
newCell.innerHTML = cellBMax + "  "
break
case 7:
newCell.innerHTML = cellWMax + "  "
break
}
}
}
Does this help explain my question.
-
Oct 30th, 2001, 06:54 PM
#4
Fanatic Member
Maybe
Code:
<script>
document.write("<font face='arial' size='-1'>");
</script>
will work?
-
Oct 30th, 2001, 07:00 PM
#5
PowerPoster
ok, i just have a few questions. i am trying to help, but i'm confused.
A) Are you sure that fontSizeAdjust is actually implemented in IE/NS6? I saw it on w3c but that doesn't mean the browsers support it.
B) Wouldn't it be easier to open the file in notepad, and do a find and replace to change all the font sizes?
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Oct 31st, 2001, 09:18 AM
#6
Thread Starter
Frenzied Member
Originally posted by sail3005
ok, i just have a few questions. i am trying to help, but i'm confused.
A) Are you sure that fontSizeAdjust is actually implemented in IE/NS6? I saw it on w3c but that doesn't mean the browsers support it.
Arrrrgh! That's the problem. It's supported in IE/Mac 5 and NN 6 but not IE/Windows. And the company standard is Win2K & IE 5.0.
I'm just beginning to work with javascript and my first thought was that I was using the wrong property.
B) Wouldn't it be easier to open the file in notepad, and do a find and replace to change all the font sizes?
That would defeat the concept of DHTML
I think I'll take another look at innerHTML. From what I am reading, I think that will give me what I want.
-
Oct 31st, 2001, 10:18 AM
#7
Thread Starter
Frenzied Member
Modifying the strings hd_size and td_size and prefixing them to the contents of innerHTML worked.
Code:
if (screen.width == 800)
{
hd_size = "<FONT SIZE=-1>"
td_size = "<FONT SIZE=-2>"
}
else
{
hd_size = ""
td_size = "<FONT SIZE=-1>"
}
.
.
function insertTableRow()
{
var newCell
var newRow = theTableBody.insertRow(-1)
newRow.style.textAlign = "RIGHT"
newRow.style.fontFamily = "ARIAL"
for (var i = 0; i < THData.length; i++)
{
newCell = newRow.insertCell(i)
switch (i)
{
case 0:
newCell.innerHTML = td_size + "  " + cellIP + "</FONT>"
newCell.style.backgroundColor = cellBG
newCell.style.textAlign = "LEFT"
break
case 1:
newCell.innerHTML = td_size + cellTO + " of " +
document.all.sample_count.value + "  </FONT>"
break
//etc., etc.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|