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!

<DIV> tag problem

Status
Not open for further replies.
Apr 27, 1999
705
US

Hi,

I have a SELECT drop down in an ASP page that works fine. WHen I introduce a <DIV> and </DIV> tag, the SELCT menu just prints out the options from the DIV tag. Any ideas?

THanks ahead of time.

fengshui_1998
 
All,

Additional info...

The DIV tag works in IE but not in NETSCAPE.


fengshui_1998
 
cLFlaVA,

Thanks for your help. Here's the code


<html>
<head>
<title>xxx</title>

</style>

</head>
<%
' Retrieve parameters
strmonth = request.querystring("mo")
strYear = request.querystring("yr")
if strMonth = "" then

' default to today's calendar month and year
nMonth = month(now)
strMonth = monthName(nmonth)
strYear = Year(now)

end if

if strMonth = "January" then
m1 = "selected"
elseif strMonth = "February" then
m2 = "selected"
elseif strMonth = "March" then
m3 = "selected"
elseif strMonth = "April" then
m4 = "selected"
elseif strMonth = "May" then
m5 = "selected"
elseif strMonth = "June" then
m6 = "selected"
elseif strMonth = "July" then
m7 = "selected"
elseif strMonth = "August" then
m8 = "selected"
elseif strMonth = "September" then
m9 = "selected"
elseif strMonth = "October" then
m10 = "selected"
elseif strMonth = "November" then
m11 = "selected"
elseif strMonth = "December" then
m12 = "selected"
End If

if strYear = "2005" then
y1 = "selected"
elseif strYear = "2006" then
y2 = "selected"
end if

Table_Name = "Calendar_" & strYear

' Create a command object. This object serves to run our queries
Set cnDB = Server.CreateObject("ADODB.Connection")

' The Connection string looks for a database file called database
connStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("Calendar.mdb")
On error Resume Next
cnDB.Open ConnStr
' response.write "ERROR: " & err.number & " " & err.description

' Retrieve the results in a recordset object
strSEL = "[Month],[1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20]," & _
"[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31]"
strSQL = "SELECT " & strSEL & " FROM " & Table_Name & " WHERE MONTH = '" & strMonth & "'"
Set rsDB = Server.CreateObject("ADODB.Recordset")
rsDB.Open strSQL, cnDB, 3, 3
%>
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#FFFFFF" VLINK="#FFFFFF" ALINK="#ffffff" onResize="OnWeResize()">

<form name="mycal" action="select2.asp" method="get">

<%
'<DIV CLASS=F16 STYLE="position:absolute;left:376;top:59;width:267;height:20;">text here</DIV>
%>
<select name="mo">
<option value="January" "<%=m1%>" >January</option>
<option value="February" "<%=m2%>" >February</option>
<option value="March" "<%=m3%>" >March</option>
<option value="April" "<%=m4%>" >April</option>
<option value="May" "<%=m5%>" >May</option>
<option value="June" "<%=m6%>" >June</option>
<option value="July" "<%=m7%>" >July</option>
<option value="August" "<%=m8%>" >August</option>
<option value="September" "<%=m9%>" >September</option>
<option value="October" "<%=m10%>" >October</option>
<option value="November" "<%=m11%>" >November</option>
<option value="December" "<%=m12%>" >December</option>
</select>

<select name="yr">
<option value="2005" "<%=y1%>" >2005</option>
<option value="2006" "<%=y2%>" >2006</option>
</select>

<input type="submit" name="update" class="btn" value="Update">


<p STYLE="position:relative;left:100;top:170;height:19">
<TABLE BORDER=3 CELLSPACING=3 CELLPADDING=3 class='tbl'>
<TR><TD COLSPAN="7" ALIGN='center' class='hd1'><B><%=strMonth%>, <%=strYear%></B></TD></TR>

<TR>
<TD ALIGN=center class='td1'><font class='F1'>Sun</font></TD>
<TD ALIGN=center class='td1'><font class='F1'>Mon</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Tue</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Wed</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Thu</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Fri</font</TD>
<TD ALIGN=center class='td1'><font class='F1'>Sat</font</TD>
</TR>

<%

' Write out the days of the month. if "dow" (day of week) errors, then that is an invalid date.
For I = 1 to 31

strDate = strMonth & " " & I & ", " & strYear
On Error Resume Next
dow = DatePart("w", strDate)

' This errors if the date is invalid and exits the FOR LOOP
if err.number = 13 then
exit for
end if

' This is a valid day so get the contents. If no data for this day, display a blank day
if rsDB.fields(I).value = "" or ISNULL( rsDB.fields(I).value) then
strVal = "&nbsp;"
else
'
' This is the actual string in the table for this day.
strVal = rsDB.fields(I).value
end if


' This line writes the date number at the top right of the calendar day
tblDay = "<table border=0 ><tr><td align='left' valign='top' width=60 height=12>" & _
"<font class='cal'>" & I & "</font></td></tr></table>"

If I = 1 then
'
Response.write "<tr valign='top'>"
xdays = 7 -(7 - dow + 1)
' If the first day of the month lands in mid-week, write blank days from Sunday till xdays.
For J = 1 to xdays
response.write "<td align='right' valign='top' width=50 height=12>" & _
"<font class='cal'>" & "&nbsp;" & "</font></td>"
Next
' Now write the first day
response.write "<td width=70>" & tblDay & "<center>" & strVal & "</center>" & "</font></td>"

ElseIf dow = 1 then
'
' This line writes the first day of the week (Sunday) that is not the first week of the month.
response.write "<tr valign='top'><td align='right' width=70 >" & _
tblDay & "<center>" & strVal & "</center>" & "</td>"

Elseif dow = 7 then
'
' This line writes the last day of the week (Saturday).
response.write "<td width=70>" & tblDay & strVal & "</td></tr>"

Else
' This line writes any other day of the week.
response.write "<td width=70>" & tblDay & strVal & "</td>"
End if

Next
' Close all connections
rsDB.Close
Set rdDB = Nothing
cnDB.Close
Set cnDB = Nothing
%>
</table>
</form>
</body>
</html>
 
cLFlaVa,

THe DIV tag is commented out right now.

<%
'<DIV CLASS=F16 STYLE="position:absolute;left:376;top:59;width:267;height:20;">text here</DIV>
%>


should be

<DIV CLASS=F16 STYLE="position:absolute;left:376;top:59;width:267;height:20;">text here</DIV>


fengshui_1998
 
Nothing really sticks out. What exactly are you saying you're experiencing? I cannot make heads and toes of 'SELCT menu just prints out the options from the DIV tag'. Better than printing source source would be to print out asp processed html page. Just open the page in the browser, view source and copy it here.
 
cLFlaVa,

I found the problem. It is the "style" in the DIV tag. When I remove "position:relative", the drop down appears, however the positioning of the the drop down is not where it is supposed to be. "left" does not work but the "top:" does. Go figure?

fengshui_1998
 
The DIV tag works in IE but not in NETSCAPE.

Wrong answer - lose 10 points.

The div element works just fine in both IE and Netscape (assuming you're not talking about archaic NN4). It will be your code that is not working.

As Vragabond has mentioned - give us the client-side source, as debugging what you have given is a real pain.

Dan

[tt]D'ya think I got where I am today because I dress like Peter Pan here?[/tt]
[banghead]

 
BillyRayPreachersSon;

I am using Netscape 4.7. Here is the code from"View Source".
Thanks,

fengshui_1998

--------------------------
<html>
<head>
<title>Londonderry Calendar of Events</title>
<TITLE> Town Facts </TITLE>
<META NAME="Author" CONTENT="Web Easy by V Communications, Inc.">
<META NAME="Keywords" CONTENT="Digital Camera,Photo Album,Image Editing,Web Easy,Scanner,VCOM">
<META NAME="Description" CONTENT="This Page has been generated by VCOM Technology...">
<SCRIPT LANGUAGE="JavaScript">

<!--//
IE=(navigator.appName.indexOf('Microsoft') >= 0);
NS=(navigator.appName.indexOf('Netscape') >= 0);
V4=(parseInt(navigator.appVersion) >= 4);
V5=(parseInt(navigator.appVersion)>=5);
V5=(V5||navigator.appVersion.indexOf("MSIE 5")!=-1);
V5=(V5||navigator.appVersion.indexOf("MSIE 6")!=-1);
MAC=(navigator.userAgent.indexOf('Mac')!=-1);//-->


</SCRIPT>

<SCRIPT LANGUAGE="JavaScript1.2">

<!--//
function OnWeResize()
{
if (!NS || !V4 || V5) return;
window.location.href = window.location.href;
}
//-->

</SCRIPT>

<style>
.btn {font-family:Arial;font-size:9pt;color:#00008c;}
.txt {font-family:Arial;font-size:8pt;color:#00008c;}
.cal {font-family:Arial;font-size:8pt;color:#00008c;text-align:right;}
.F1 {font-family:Arial;font-size:9pt;color:#009933;font-weight:bold;background-color:#FFCC66;}
.F14 {font-family:Times New Roman;font-size:24pt;font-weight:bold;color:#000000;}
.F15 {font-family:Times New Roman;font-size:24pt;color:#808080;}
.F17 {font-family:Arial;font-size:8pt;font-weight:bold;color:#0000ff;}
.F13 {font-family:Arial;font-size:8pt;font-weight:bold;color:#ffffff;}
.F16 {font-family:Arial;font-size:10pt;font-weight:bold;color:#000000;}
.F18 {font-family:Arial;font-size:10pt;
font-weight:bold;color:#FF9900;text-decoration:none;}
.td1 {background-color:#FFCC66;}
.hd1 {background-color:#FFCC99;color:#006600;font-family:Monotype Corsiva;font-size:14pt;}
.tbl {
background-color:#FFFFCC;
border:2px solid black;
border-style:ridge;
border-color:#FF0000;
border-width:thick; }
.tbl2 {
background-color:#00706D;
border:2px solid black;
border-style:ridge;
border-color:#FF0000;
border-width:thick; }


</style>

</head>


<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#FFFFFF" VLINK="#FFFFFF" ALINK="#ffffff" onResize="OnWeResize()">

<form name="mycal" action="select2.asp" method="get">
<p CLASS=F18 ><a href="Londonderry.htm"><font class="txt">Home</font></a></p>


<select name="mo" STYLE="position:absolute;left:181;">
<option value="January" >January</option>
<option value="February" >February</option>
<option value="March" >March</option>
<option value="April" >April</option>
<option value="May" selected >May</option>
<option value="June" >June</option>
<option value="July" >July</option>
<option value="August" >August</option>
<option value="September" >September</option>
<option value="October" >October</option>
<option value="November" >November</option>
<option value="December" >December</option>
</select>

<select name="yr">
<option value="2005" selected >2005</option>
<option value="2006" >2006</option>
</select>

<input type="submit" name="update" class="btn" value="Update">


<p style="padding-left:75; padding-right:100">
<TABLE BORDER=3 CELLSPACING=3 CELLPADDING=3 class='tbl'>
<TR><TD COLSPAN="7" ALIGN='center' class='hd1'><B>May, 2005</B></TD></TR>

<TR>
<TD ALIGN=center class='td1'><font class='F1'>Sun</font></TD>
<TD ALIGN=center class='td1'><font class='F1'>Mon</font></TD>
<TD ALIGN=center class='td1'><font class='F1'>Tue</font></TD>
<TD ALIGN=center class='td1'><font class='F1'>Wed</font></TD>
<TD ALIGN=center class='td1'><font class='F1'>Thu</font></TD>
<TD ALIGN=center class='td1'><font class='F1'>Fri</font></TD>
<TD ALIGN=center class='td1'><font class='F1'>Sat</font></TD>
</TR>

<tr valign='top'><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>1</font></td></tr></table><center>&nbsp;</center></font></td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>2</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>3</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>4</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>5</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>6</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>7</font></td></tr></table>&nbsp;</td></tr><tr valign='top'><td align='right' width=70 ><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>8</font></td></tr></table><center><font class='txt'>Mother's Day</font></center></td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>9</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>10</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>11</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>12</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>13</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>14</font></td></tr></table>&nbsp;</td></tr><tr valign='top'><td align='right' width=70 ><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>15</font></td></tr></table><center>&nbsp;</center></td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>16</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>17</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>18</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>19</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>20</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>21</font></td></tr></table>&nbsp;</td></tr><tr valign='top'><td align='right' width=70 ><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>22</font></td></tr></table><center>&nbsp;</center></td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>23</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>24</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>25</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>26</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>27</font></td></tr></table>&nbsp;</td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>28</font></td></tr></table>&nbsp;</td></tr><tr valign='top'><td align='right' width=70 ><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>29</font></td></tr></table><center>&nbsp;</center></td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>30</font></td></tr></table><font class='txt'>Memorial Day</font></td><td width=70><table border=0 ><tr><td align='left' valign='top' width=60 height=12><font class='cal'>31</font></td></tr></table>&nbsp;</td>
</table>

</form>
</body>
</html>

 

I can't see a DIV tag in your code. How about you repost... but enclose the source in [CODE] your code here [/CODE] tags (so we can be sure that nothing is being truncated etc).

Cheers,
Jeff

 
NN4.7 is an ancient browser that has sketchy support for some CSS. I am pretty sure it will choke severely on positioning since even modern browsers sometimes cannot handle that. Since NN4 has been outdated for around 6 or more years now I think it is safe for you to stop supporting it. Other than that, I do not know why you need absolute positioning for the select element -- judging from what the page looks now, what you're trying to achieve requires no positioning at all.
 
All,

I upgraded to Netscape 7.2 and the problem went away. Thanks for all your help!!!!


fengshui_1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top