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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get html output?

Status
Not open for further replies.

longmatch

Programmer
Nov 1, 2001
406
Dear All:
I have got a piece of code written in ASP and javascript to populate two linked-combo box based upon recordset from a database. Do you think I can see the html output which derived from ASP server side?

Thanks

Haijun

see my code below:

<!--#include file=&quot;Clssfdpage.asp&quot;-->
<HTML>
<HEAD>
<META NAME=&quot;GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0&quot;>
<TITLE></TITLE>
</HEAD>
<BODY>
<form name=&quot;f1&quot;>
<%
Set rsX = Server.CreateObject(&quot;ADODB.Recordset&quot;)
sQuery = &quot;SELECT category AS name, procedure AS model, &quot; & _
&quot;categoryID AS ManuID, procedureID AS ModelID &quot; & _
&quot;FROM CategoryProcedure&quot;
rsX.Open sQuery, objConn, adOpenForwardOnly, _
adLockReadOnly, adCmdText
If rsX.EOF Then
Response.Write &quot;No manufacturers.<BR>&quot;
Else
' write the manufacturers listbox...
Response.Write &quot;<SELECT NAME=&quot;&quot;manufacturer&quot;&quot; &quot; & _
&quot; ONCHANGE=&quot;&quot;manuselected(this);&quot;&quot; >&quot;
' write the entry code for the javascript...
sJavaScript = &quot;function manuselected(elem){&quot; & vbCrlf & _
&quot;for (var i = document.f1.model.&quot; & _
&quot;options.length; i >= 0; i--){&quot; & vbCrlf & _
&quot;document.f1.model.options = null;&quot; & _
vbCrlf
' loop through the recordset...
Do Until rsX.EOF
' is this a new manufacturer?
If sLastManufacturer <> rsX(&quot;Name&quot;) Then
' if so, add an entry to the first listbox
sLastManufacturer = rsX(&quot;Name&quot;)
Response.Write &quot;<OPTION VALUE=&quot; & rsX(&quot;ManuID&quot;) & _
&quot;>&quot; & sLastManufacturer & &quot;</OPTION>&quot;
' and add a new section to the javascript...
sJavaScript = sJavaScript & &quot;}&quot; & vbCrlf & _
&quot;if (elem.options[elem.selectedIndex].value==&quot; & _
rsX(&quot;ManuID&quot;) & &quot;){&quot; & vbCrlf
End If
' and add a new model line to the javascript...
sJavaScript = sJavaScript & _
&quot;document.f1.model.options[document.&quot; & _
&quot;f1.model.options.length] = new Option('&quot; & _
rsX(&quot;Model&quot;) & &quot;','&quot; & rsX(&quot;ModelID&quot;) & _
&quot;');&quot; & _
vbCrlf
rsX.MoveNext
Loop
' finish the manufacturer listbox...
Response.Write &quot;</SELECT><br>&quot;

' create the models listbox...
Response.Write &quot;<SELECT NAME=&quot;&quot;model&quot;&quot;>&quot;
Response.Write &quot;<OPTION>[none currently selected]</OPTION>&quot;
Response.Write &quot;</SELECT>&quot;
' put the last line on the javascript...
' and write it out...
sJavaScript = sJavaScript & vbCrlf & &quot;}&quot; & vbCrlf & _
&quot;}&quot; & vbCrlf
Response.Write &quot;<SCRIPT LANGUAGE=&quot;&quot;JavaScript&quot;&quot;>&quot; & vbCrlf
Response.Write sJavaScript & vbCrlf & &quot;</SCRIPT>&quot; & vbCrlf
End If
rsX.Close
Set rsX = Nothing
%>
</form>
</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top