aabruzzese
09-25-2002, 05:44 AM
Hello Everyone,
I am new to the forum and am looking for some help with VBSCRIT.
I am creating a drop down box with options populated from a database, what I am looking to do is to insert an <img =
tag as the option instead of the text in a field.
here is a snippet of the code:
' Build our drop down box of ships with name as value and a bitmap as option
If Not Ships.EOF Then
Ships.MoveFirst
%>
<select name="id">
<option></option>
<% ' Loop through names
Do While Not Ships.EOF
Response.Write "<option value="""
Response.Write Ships.Fields"Name")
Response.Write """"
If Ships.Fields("Name") = CIn (iRequestedID) Then
Response.Write "selected=""true"""
End If
Response.Write ">"
Response.Write("<img width=42 height=42 SRC='"& StrImgPath & Patrol & "'>")
Response.Write " "
Response.Write Trim(Ships.Fields ("Name"))
Response.Write "</option>" & vbCrLf
' Move to next record
Ships.MoveNext
Loop
%>
</select>
<%
End If
The part that is not working is the image, how do i code that so instead of showing the content of some field, i show an image I am pointing to.
Not : Patrol is pulled from the DB and contains the name of the bitmap and StrImgPath is a variable containing the path.
Any help would be greatly appreciated.
Angelo
I am new to the forum and am looking for some help with VBSCRIT.
I am creating a drop down box with options populated from a database, what I am looking to do is to insert an <img =
tag as the option instead of the text in a field.
here is a snippet of the code:
' Build our drop down box of ships with name as value and a bitmap as option
If Not Ships.EOF Then
Ships.MoveFirst
%>
<select name="id">
<option></option>
<% ' Loop through names
Do While Not Ships.EOF
Response.Write "<option value="""
Response.Write Ships.Fields"Name")
Response.Write """"
If Ships.Fields("Name") = CIn (iRequestedID) Then
Response.Write "selected=""true"""
End If
Response.Write ">"
Response.Write("<img width=42 height=42 SRC='"& StrImgPath & Patrol & "'>")
Response.Write " "
Response.Write Trim(Ships.Fields ("Name"))
Response.Write "</option>" & vbCrLf
' Move to next record
Ships.MoveNext
Loop
%>
</select>
<%
End If
The part that is not working is the image, how do i code that so instead of showing the content of some field, i show an image I am pointing to.
Not : Patrol is pulled from the DB and contains the name of the bitmap and StrImgPath is a variable containing the path.
Any help would be greatly appreciated.
Angelo