www.webdeveloper.com
Results 1 to 8 of 8

Thread: DOCTYPE Messed up my formatting

  1. #1
    Join Date
    Jun 2011
    Posts
    16

    DOCTYPE Messed up my formatting

    Hello,

    After putting some code in to highlight a row with the use of images my formatting as gone to pot. If I remove the DOCTYPE it goes back to normal however soon as the DOCTYPE is put in then it goes wrong.

    Does anyone know why this is happening and if so how I can correct it?

    My Code is below:

    Code:
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html> 
    <head> <title>SearchAD</title> <!--  
    HTA to search AD and perform various user and computer actions  
    Also to create, modify and remove users. 
    Written by James Cartwright 
    --> <HTA:APPLICATION      APPLICATIONNAME="SearchAD" 
         BORDER = "Thin" 
         SCROLL = "no" 
         SINGLEINSTANCE = "Yes" 
         WINDOWSTATE = "Normal" 
         SYSMENU = "No" 
    > <style type="text/css"> 
    .table{  
      overflow:auto; 
      height:210px; 
    } table.tableRowHover { 
    width: 600px; 
    } 
    table.tableRowHover tr.trHover { 
    background: url(normal.jpg) no-repeat 0 0; 
    position: relative; 
    } 
    table.tableRowHover tr:hover { 
    background-position: 0 -68px; 
    } 
    table.tableRowHover td { 
    height: 50px; 
    background-image: none; 
    } .general { 
     font-family:arial; 
     font-style:bold; 
     font-size: 16;  } </style> 
    </head> <script language="VBScript"> Sub Window_onLoad    
      
    Set objFSO = CreateObject("Scripting.FileSystemObject")     Me.ResizeTo 670,570 
        Me.MoveTo ((Screen.Width / 2) - 200),((Screen.Height / 2) - 250) 
        lstValues.Style.Width = 200 
         
    If objFSO.FileExists("P:\Powershell\temp.csv") Then 
     document.getElementById("tblResults").style.visibility ="visible" 
     document.getElementById("tblhead").style.visibility ="visible" 
    Else 
    document.getElementById("tblResults").style.visibility ="hidden" 
    document.getElementById("tblhead").style.visibility ="hidden" 
    End If End Sub Sub SubmitText Set objShell = CreateObject("WScript.Shell")    
    Set objFSO = CreateObject("Scripting.FileSystemObject")  
          
    If objFSO.FileExists("P:\Powershell\temp.txt") Then 
    objFSO.DeleteFile("P:\Powershell\temp.txt"),True 
    End If Set textTemp = objFSO.OpenTextFile("P:\Powershell\temp.txt",8,True)  
        textTemp.WriteLine txtsearch.value 
        textTemp.Close 
    objShell.Run "powershell.exe &'P:\Powershell\QueryAD.ps1'",0,True 
    window.location.reload()  End Sub 
       
    Function run Set objShell=CreateObject("Wscript.Shell") Select Case True 
      
     Case UnlockUser.Checked 
      objShell.Run "powershell.exe -noexit &'C:\UserAdmin\UnlockUser.ps1'",0,True 
     Case ChangePW.Checked 
      objShell.Run "powershell.exe -noexit &'C:\UserAdmin\ChangePassword.ps1'",0,True 
     Case EnableUser.Checked 
      objShell.Run "powershell.exe -noexit &'C:\UserAdmin\EnableUser.ps1'",0,True 
     Case DisableUser.Checked 
      objShell.Run "powershell.exe -noexit &'C:\UserAdmin\DisableUser.ps1'",0,True End Select  End Function 
           
    Function leave Set objFSO = CreateObject("Scripting.FileSystemObject") 
           
    If objFSO.FileExists("P:\Powershell\temp.csv") Then 
    objFSO.DeleteFile("P:\Powershell\temp.csv"),True 
    End If window.close End Function </script>  <body STYLE="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')">       
        <table width='90%' height = '20%' border='0'>         
                <tr> 
                      <td align="center" class="general"> 
                            <b>Search AD</b> 
                      </td> 
                </tr> 
                <tr> 
                      <td align='left' id="lstValues" class="general"> 
          <br><br>User Search:  <input type="text" name="txtsearch" /> 
          <input type="submit" value="Submit" onclick="SubmitText" /> 
        </td> 
                </tr>   
       </table>   
           
    <object ID=temp classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83"> 
      <param nAme="DataURL" value="temp.csv"> 
      <param nAme="UseHeader" value="true"> 
    </object> <table id="tblhead" cellpadding="3"> 
    <thead> 
         <tr><th width="150">Name</th><th width="73%">OU</th></tr> 
    </thead>  
    </table> 
    <div class="table"> 
    <table id="tblResults" class="tableRowHover" datasrc='#temp' border="1" cellpadding="3"> 
         <tr class="trHover"> 
         <td width="150"><span datafld='Name'> </span></td> 
         <td><span datafld='ParentContainer'></span></td></tr> 
    </table>    
    </div> 
    <table> 
    <col class="general" /> 
    <col span="2" class="general" /> 
    <tr> 
     <td><input type="radio" name="usrtools" value="UnlockUser" id="UnlockUser"> Unlock User Account<br> 
     <td><input type="radio" name="usrtools" value="ChangePW" id="ChangePW"> Change User Password (Complex)<br>  
    </tr> 
    <tr> 
     <td><input type="radio" name="usrtools" value="EnableUser" id="EnableUser"> Enable User Account</td><br> 
     <td><input type="radio" name="usrtools" value="DisableUser" id="DisableUser"> Disable User Account</td><br> 
    </tr>  
    </table>   
       <div align="right">               
                         <input type="button" value="Close" name="btn_Close" onClick="vbs:Execute('leave')"> 
                </div>             
    </body>

    Many Thanks

    James

  2. #2
    Join Date
    Dec 2010
    Posts
    59
    Sounds like you're using the wrong doctype then.

  3. #3
    Join Date
    Jun 2011
    Posts
    16
    Apparently the DOCTYPE I am using is correct as when I take it out the highlighting of the rows stops working so I need it for that which was the reason it was put in there...

    Do you have any suggestions how I can get around it?

    Many Thanks

  4. #4
    Join Date
    Dec 2010
    Posts
    59
    Try <!DOCTYPE html>

  5. #5
    Join Date
    Jun 2005
    Location
    United Kingdom
    Posts
    1,043
    At a quick guess you have CSS faults, and maybe invalid xhtml. The advice here is as good as the day it was written.

  6. #6
    Join Date
    Jun 2011
    Posts
    16
    I have tried your DOCTYPE suggestion and although the highlighting stays as it is and works (which is good) the formatting is still all out.

    And do you have any ideas where the CSS faults are? I am not very experienced with HTML, Javascript and CSS so I am learning as I am going so any pointers would be greatly appreciated.

    Many Thanks

    James

  7. #7
    Join Date
    Jun 2011
    Posts
    16
    Hello,

    I have changed my CSS as per the validation tool and changed the 3 errors I had so my new code is:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
    <head>
    
    <title>SearchAD</title>
    
    <!-- 
    HTA to search AD and perform various user and computer actions 
    Also to create, modify and remove users.
    Written by James Cartwright
    -->
    
    <HTA:APPLICATION 
    
         APPLICATIONNAME="SearchAD"
         BORDER = "Thin"
         SCROLL = "no"
         SINGLEINSTANCE = "Yes"
         WINDOWSTATE = "Normal"
         SYSMENU = "No"
    > 
    
    <style type="text/css">
    .tbl{ 
    		overflow: auto;
    		height: 210px;
    		font-family: arial;
    		font-weight: normal;
    		font-size: 10pt;
    }
    
    table.tableRowHover {
    width: 600px;
    }
    table.tableRowHover tr.trHover {
    background: url(normal.jpg) no-repeat 0 0;
    position: relative;
    }
    table.tableRowHover tr:hover {
    background-position: 0 -68px;
    cursor: pointer;
    }
    table.tableRowHover td {
    height: 50px;
    background-image: none;
    }
    
    .general {
    	font-family: arial;
    	font-weight: normal;
    	font-size: 12pt;	
    
    }
    
    </style>
    </head>
    
    <script language="VBScript">
    
    Sub Window_onLoad   
     
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    
        Me.ResizeTo 670,570
        Me.MoveTo ((Screen.Width / 2) - 200),((Screen.Height / 2) - 250)
        lstValues.Style.Width = 200
    
    document.getElementById("srch").style.visibility ="hidden"
        
    If objFSO.FileExists("P:\Powershell\temp.csv") Then
     document.getElementById("tblResults").style.visibility ="visible"
     document.getElementById("tblhead").style.visibility ="visible"
    Else
    document.getElementById("tblResults").style.visibility ="hidden"
    document.getElementById("tblhead").style.visibility ="hidden"
    End If
    
    End Sub
    
    Sub SubmitText 
    
    If document.getElementById("srch").style.visibility ="hidden" Then
    document.getElementById("srch").style.visibility ="visible"
    End If
    
    Set objShell = CreateObject("WScript.Shell")   
    Set objFSO = CreateObject("Scripting.FileSystemObject") 
         
    If objFSO.FileExists("P:\Powershell\temp.txt") Then
    objFSO.DeleteFile("P:\Powershell\temp.txt"),True
    End If
    
    Set textTemp = objFSO.OpenTextFile("P:\Powershell\temp.txt",8,True) 
        textTemp.WriteLine txtsearch.value
        textTemp.Close
    objShell.Run "powershell.exe &'P:\Powershell\QueryAD.ps1'",0,True
    window.location.reload()
    
     End Sub
      
    Function run
    
    Set objShell=CreateObject("Wscript.Shell")
    
    Select Case True
    	
    	Case UnlockUser.Checked
    		objShell.Run "powershell.exe -noexit &'C:\UserAdmin\UnlockUser.ps1'",0,True
    	Case ChangePW.Checked
    		objShell.Run "powershell.exe -noexit &'C:\UserAdmin\ChangePassword.ps1'",0,True
    	Case EnableUser.Checked
    		objShell.Run "powershell.exe -noexit &'C:\UserAdmin\EnableUser.ps1'",0,True
    	Case DisableUser.Checked
    		objShell.Run "powershell.exe -noexit &'C:\UserAdmin\DisableUser.ps1'",0,True
    
    End Select  
    
    End Function
    
          
    Function leave
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
          
    If objFSO.FileExists("P:\Powershell\temp.csv") Then
    objFSO.DeleteFile("P:\Powershell\temp.csv"),True
    End If
    
    window.close
    
    End Function
    
    </script>
    
    <script type="text/javascript">
    
    function getInfo() 
    {
    var Row = document.getElementById("tblrow");
    var Cells = Row.getElementsByTagName("td");
    alert(Cells[0].innerText);
    }
    
    </script>
    
    </head>
     <body style="font:14 pt arial; color:white;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#000033', EndColorStr='#0000FF')">      
        <table width='90&#37;' height = '20%' border='0'>        
                <tr>
                      <td align="center" class="general">
                            <b>Search AD</b>
                      </td>
                </tr>
                <tr>
                      <td align='left' id="lstValues" class="general">
    						<br><br>User Search:  <input type="text" name="txtsearch" />
    						<input type="submit" value="Go" onclick="SubmitText" />
    						<img id="srch" alt="Searching..." src="searching.gif">
    			 </td>
                </tr>  
       </table>  
          
    <object ID=temp classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
      <param nAme="DataURL" value="temp.csv">
      <param nAme="UseHeader" value="true">
    </object>
    
    <table id="tblhead" cellpadding="3">
    <thead>
         <tr><th width="150">Name</th><th width="73%">OU</th></tr>
    </thead> 
    </table>
    <div class="tbl">
    <table id="tblResults" class="tableRowHover" datasrc='#temp' border="1" cellpadding="3">
         <tr id="tblrow" class="trHover" onclick="getInfo()">
         <td width="150"><span id="name" datafld='Name'> </span></td>
         <td><span datafld='ParentContainer'></span></td></tr>
    </table>   
    </div>
    <table>
    <col class="general" />
    <col span="2" class="general" />
    <tr>
    	<td><input type="radio" name="usrtools" value="UnlockUser" id="UnlockUser"> Unlock User Account<br>
    	<td><input type="radio" name="usrtools" value="ChangePW" id="ChangePW"> Change User Password (Complex)<br>	
    </tr>
    <tr>
    	<td><input type="radio" name="usrtools" value="EnableUser" id="EnableUser"> Enable User Account</td><br>
    	<td><input type="radio" name="usrtools" value="DisableUser" id="DisableUser"> Disable User Account</td><br>
    </tr>	
    </table>		
    			<div align="right">              
                	        <input type="button" value="Close" name="btn_Close" onClick="vbs:Execute('leave')">
                </div>            
    </body>
    </html>
    Still my formatting is out does anyone have any other suggestions?

    Many Thanks

    James

  8. #8
    Join Date
    Jun 2011
    Posts
    16
    Hello,

    I have sorted my formatting out by putting my table as a seperate html document and calling it inside an IFRAME. Its now working as it should.

    Many Thanks

    James

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles