Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table question 1

Status
Not open for further replies.

Snappy2873

Programmer
Mar 29, 2002
54
US
How do I lock a table into staying one size horizontally?
Here is my code for the search page that works properly. THe problem is that when I search in the "keyword" column the search results explode horizontally outside my limits I've set in the table specs. I just want the results to wrap vertically.
Here is my code:

<!--#INCLUDE FILE="include/functions_inc.asp"-->
<HTML>
<HEAD>
<%
searchtext = Request.Form("searchtext")
searchfield = Request.Form("searchfield")
IF searchtext = "" Then%>
<TITLE>TechLibrary V3.0</TITLE>
<%ELSE%>
<TITLE>TechLibrary V3.0 Search Results for <%=searchtext%></TITLE><%
END IF%>
<script>
//JSCRIPT
function ChangeButton(what)
{
if(what.className == ""){
what.className = "mouseover"
}else{
what.className = ""
}
}
function CheckFields()
{
if(document.frmsearch.searchfield.value==""){
alert("Please select a Category!")
document.frmsearch.searchfield.focus();
}else{
if(document.frmsearch.searchtext.value==""){
alert("Please enter some search criteria!")
document.frmsearch.searchtext.focus();
}else{
document.frmsearch.method="post"
document.frmsearch.action="docsearch.asp"
document.frmsearch.submit();
}
}
}
</script>

<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
function window_onload()
{
document.frmsearch.searchfield.focus();
}
</SCRIPT>
</HEAD>

<BODY LANGUAGE=javascript onload="return window_onload()">
<FORM ACTION="" METHOD="post" NAME="frmsearch" onSubmit="return false">
<BR>
<%IF searchtext = "" THEN%>
<TABLE>
<TR>
<TD class="_header_">TechLibrary V3.0 Document Search</TD>
</TR>
<TR>
<TD>&nbsp;</TD>
</TR>
</table>
<TABLE>
<TR>
<TD>Category field:<select name="searchfield">
<option value="">
Please select one of the following
<option value="docident">Document Identifier
<option value="doctitle">Document Title
<option value="dockeyword">Keywords
<option value="docloc">Location
<option value="docauthor">Author
</select></TD>
</tr>
<tr>
<TD>Text to search for:<INPUT NAME="searchtext" SIZE=30 MAXLENGTH=64></TD>
</TR>
<TR>
<TD><INPUT TYPE="submit" VALUE="SEARCH" ONMOUSEOVER="ChangeButton(this);" onmouseout="ChangeButton(this);" onclick="CheckFields();" id=submit1 name=submit1>&nbsp;&nbsp;<INPUT TYPE="reset" VALUE="RESET" ONMOUSEOVER="ChangeButton(this);" onmouseout="ChangeButton(this);" id=reset1 name=reset1></div></TD>
</TR>
</TABLE>
<%ELSE%>
<TABLE>
<TR>
<TD class="header">TechLibrary V3.0 Search Results</TD>
</TR>
<TR>
<TD>&nbsp;</TD>
</TR>
</table>
<%
jiggy1 = "SELECT * FROM [tblDocument] "
select case searchfield
case "'docident'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case "'doctitle'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case "'dockeyword'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case "'docloc'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case "'docauthor'"
jiggy2 = "WHERE " & searchfield & " = " & searchtext & " "
case else
jiggy2 = "WHERE " & searchfield & " like '%" & searchtext & "%' "
end select
jiggy3 = "ORDER BY docident, doctitle, dockeyword, docloc, docauthor"
stmt = jiggy1 & jiggy2 & jiggy3
call ConnectDB()
Set objRS = objConn.Execute(stmt, , adCmdText)
if not objRS is nothing then
if not objRS.bof and not objRS.eof then
%>

<TABLE width="55%" align="center" cellpadding=2 cellspacing-2 border=1>
<TR>
<TD class="detailsdark">Document Identifier</TD>
<TD class="detailsdark">Title</TD>
<TD class="detailsdark">Keywords</TD>
<TD class="detailsdark">Location</TD>
<TD class="detailsdark">Author</TD>
</TR>
<%do until objRS.EOF%>
<TR>
<TD class="detailslightleft" COLSPAN=1>
<%= objRS.Fields("docident")%>
</TD>
<TD class="detailslightleft" COLSPAN=1>
<%= objRS.Fields("doctitle")%>
</TD>
<TD class="detailslightleft" COLSPAN=1>
<%= objRS.Fields("dockeyword")%>
</TD>
<TD class="detailslight" COLSPAN=1>
<%= objRS.Fields("docloc")%>
</TD>
<TD class="detailslight" COLSPAN=1>
<%= objRS.Fields("docauthor")%>
</TD>
<TD class="detailslight">
<A HREF="return false" onmousedown="javascript:OpenWindow('iamges/docentry.asp')">View Doc entry</A>
</TD>
<TD class="detailslight">
<A HREF="return false" onmousedown="javascript:OpenWindow('images/docentry.asp')">Edit Doc entry</A>
</TD>
<%objRS.Movenext%>
</TR>
<%lOOP%>
</TABLE><%
objRS.CLose
Set objRS = Nothing
else%>
<TABLE>
<TR>
<TD class="detailsdark">Nothing Found!</TD>
</TR>
</table>
<%end if
else%>
<TABLE>
<TR>
<TD class="detailsdark">Nothing Found!</TD>
</TR>
</table><%
end if
call DisConnectDB()
END IF%>
<!--#INCLUDE FILE="include/MenuOptions_inc.asp"-->
<!--#INCLUDE FILE="navigate.asp"-->
</BODY>
</HTML>
 
Try:
Code:
<table style="table-layout:fixed">
This does not work in NS versions prior to 6 or IE versions prior to 5.


Mike Krausnick
Dublin, California
 
Hey mike,
Well I've searched high and low and tried every angle possible to fix this issue, all to no avail. I tried your fix and it worked great, thanks for the info, your a life- saver.
Have a great weekend!
snappy
 
See the link that says "Thank mkrausnick for this valuable post"?


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Thanks for the star! Glad I could help.

Mike Krausnick
Dublin, California
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top