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>
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?
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.
Bookmarks