Results 1 to 7 of 7

Thread: javascript equivelent of SIZE="-1" ???(resolved)

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177

    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.

  2. #2
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    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

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    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">
                             &nbsp;&nbsp10.0.0.242
                         </TD>
                         <TD ALIGN=RIGHT>
                             <FONT FACE="arial" SIZE="-1">
                             0 of 269&nbsp;&nbsp
                         </TD>
                         
                         <TD ALIGN=RIGHT>
                             <FONT FACE="arial" SIZE="-1">
                             4&nbsp;&nbsp
                         </TD>
                         <TD ALIGN=RIGHT>
                             <FONT FACE="arial" SIZE="-1">
                             28&nbsp;&nbsp
                         </TD>
                         <TD ALIGN=RIGHT>
                             <FONT FACE="arial" SIZE="-1">
                             5&nbsp;&nbsp
                         </TD>
                         <TD ALIGN=RIGHT>
                             <FONT FACE="arial" SIZE="-1">
                             85&nbsp;&nbsp
                         </TD>
                         <TD ALIGN=RIGHT>
                             <FONT FACE="arial" SIZE="-1">
                             5&nbsp;&nbsp
                         </TD>
                         <TD ALIGN=RIGHT>
                             <FONT FACE="arial" SIZE="-1">
                             242&nbsp;&nbsp
                         </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 =  "&nbsp;&nbsp" + cellIP
                        newCell.style.backgroundColor = cellBG
                        newCell.style.textAlign = "LEFT"
                        break
                case 1:
                        newCell.innerHTML = cellTO + " of " + 
                                            document.all.sample_count.value + "&nbsp;&nbsp"
                        break
                case 2:
                        newCell.innerHTML = cellBMin + "&nbsp;&nbsp"
                        break
                case 3:
                        newCell.innerHTML = cellWMin + "&nbsp;&nbsp"
                        break
                case 4:
                        newCell.innerHTML = cellBAvg + "&nbsp;&nbsp"
                        break
                case 5:
                        newCell.innerHTML = cellWAvg + "&nbsp;&nbsp"
                        break
                case 6:
                        newCell.innerHTML = cellBMax + "&nbsp;&nbsp"
                        break
                case 7:
                        newCell.innerHTML = cellWMax + "&nbsp;&nbsp"
                        break
               }
    	 }
        }
    Does this help explain my question.

  4. #4
    Fanatic Member Wynd's Avatar
    Join Date
    Dec 2000
    Location
    In a bar frequented by colossal death robots
    Posts
    772

    Smile

    Maybe
    Code:
    <script>
    document.write("<font face='arial' size='-1'>");
    </script>
    will work?

  5. #5
    PowerPoster sail3005's Avatar
    Join Date
    Oct 2000
    Location
    Chicago, IL, USA
    Posts
    2,340
    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

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    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.

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    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 + "&nbsp;&nbsp" + cellIP + "</FONT>"
                        newCell.style.backgroundColor = cellBG
                        newCell.style.textAlign = "LEFT"
                        break
                case 1:
                        newCell.innerHTML = td_size + cellTO + " of " + 
                                            document.all.sample_count.value + "&nbsp;&nbsp</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
  •  



Click Here to Expand Forum to Full Width