Hi all,

trying to apply CSS to and ASP page as below but there is no page structure,
head / body etc. Tried various ways to add CSS but to no avail, cant even
add font size to the ;<font color=""#FF0000"">" code.

Anyone help??

THIS IS THE ENTIRE CODE FORM PAGE - NEED TO APPLY STYLES TO sDetail SECTION.

<!--#include file="Vars.asp" -->
<!--#include file="Functions.asp" -->
<%
' Dim itm
' Response.Write("dashboard_done={{")
' For Each itm In Request.Form
' Response.Write(itm & " - " & Request.Form(itm) & ", ")
' Next
' Response.Write("}}")
' Response.End()

Dim id
Dim sql, rsBooking, rsMessage

Dim sResponse
sResponse = ""

id = Request.Form("id")
If Len(id) = 0 OR NOT IsNumeric(id) Then
Response.Write("detail_done=ERROR")
Response.End()
End If

' rsBooking...

sql = "SELECT * FROM booking_form WHERE ID=" + EncodeDbParam(id)

Set rsBooking = Server.CreateObject("ADODB.RecordSet")
rsBooking.Open sql, g_ConnectionString

If NOT rsBooking.BOF AND NOT rsBooking.EOF Then
Dim sDetail

sDetail = sDetail & "<b>" & rsBooking.Fields.Item("VEHICLE_TYPE").Value &
_
"</b> " & rsBooking.Fields.Item("JOURNEY_TYPE").Value & "<br>"

sDetail = sDetail & "Booking ref: <p class=""driver""><b>" & _
rsBooking.Fields.Item("ID").Value & "</b></p>&nbsp;<font
color=""#000066""><b>C/A</b></font>&nbsp;<font color=""#FF0000"">" &
rsBooking.Fields.Item("ACCOUNT").Value & "</font></font><br>"

sDetail = sDetail & "<span class=""driver"">" &
FormatDateTime(rsBooking.Fields.Item("TimeOfBooking").Value, vbShortTime) &
_
"</span></font>&nbsp;<font color=""#0066FF""><b>Price" &
rsBooking.Fields.Item("MileageToDriver").Value & "</b></font><br>"

sDetail = sDetail & "<font color=""#0066FF""><b>" &
rsBooking.Fields.Item("TITLE1").Value & "&nbsp;" & _
UCase((rsBooking.Fields.Item("PAX_NAME1").Value)) & "&nbsp;" &
UCase(rsBooking.Fields.Item("PAX_NAME2").Value) & "&nbsp;" & _
rsBooking.Fields.Item("PAX_NAME3").Value & "&nbsp;" &
rsBooking.Fields.Item("PAX_NAME4").Value & "</b></font><br>" & _
"<font color=""#000000"">" & rsBooking.Fields.Item("MOBILE_NO").Value &
"</font><br>"

sDetail = sDetail & "<font color=""#0066FF""><b>" &
rsBooking.Fields.Item("COLL_AIRPORT_STATION").Value & "&nbsp;" & _
rsBooking.Fields.Item("FLIGHT_NUMBER").Value & "&nbsp;" &
rsBooking.Fields.Item("DEPARTING_FROM").Value & "<br>" & _
rsBooking.Fields.Item("COLL_BUILDING_NAME_NO").Value & ",&nbsp;" & _
rsBooking.Fields.Item("COLL_STREET").Value & "<br>" &
rsBooking.Fields.Item("COLL_CITY_TOWN").Value & "<br>" & _
rsBooking.Fields.Item("COLL_COUNTY").Value & "<br>" &
UCase(rsBooking.Fields.Item("COLL_POST_CODE").Value) & "&nbsp;" & _
rsBooking.Fields.Item("COLL_CONTACT_TEL").Value & "</b></font><br>"

sDetail = sDetail & "<font color=""#FF6600""><b>" &
rsBooking.Fields.Item("DEST_AIRPORT_STATION").Value & "<br>" & _
rsBooking.Fields.Item("DEST_BUILDING_NAME_NO").Value & "&nbsp;"
& rsBooking.Fields.Item("DEST_STREET").Value & "<br>" & _
rsBooking.Fields.Item("DEST_CITY_TOWN").Value & "<br>" &
rsBooking.Fields.Item("DEST_COUNTY").Value & "<br>" & _
rsBooking.Fields.Item("DEST_POST_CODE").Value & "</b></font> <font
color=""#000000"">" & rsBooking.Fields.Item("DEST_CON_NUMBER").Value &
"</font><br>"

sDetail = sDetail & "<font color=""#000000"">" &
rsBooking.Fields.Item("VIA_ROAD1").Value & "&nbsp;" & _
rsBooking.Fields.Item("VIA_POST_CODE1").Value & "&nbsp;" &
rsBooking.Fields.Item("VIA_ROAD2").Value & "&nbsp;" & _
rsBooking.Fields.Item("VIA_POST_CODE2").Value & "&nbsp;" &
rsBooking.Fields.Item("VIA_ROAD3").Value & "&nbsp;" & _
rsBooking.Fields.Item("VIA_POST_CODE3").Value & "&nbsp;" &
rsBooking.Fields.Item("VIA_ROAD4").Value & "&nbsp;" & _
rsBooking.Fields.Item("VIA_POST_CODE4").Value & "</font><br><br>"

sDetail = sDetail & "<font color=""#000000""><b>Journey
Notes</b></font><br><font color=""#0000CC""><b>" &
rsBooking.Fields.Item("SPECIAL_INSTRUCTIONS").Value & "<b></font>"


If Len(sResponse) > 0 Then sResponse = sResponse & "&"

sResponse = sResponse & "booking_detail=" & Server.URLEncode(sDetail)
sResponse = sResponse & "&booking_found=true"
Else
' sResponse = sResponse & "No journies assigned"
End If

rsBooking.Close
Set rsBooking = NOTHING


' rsMessage ...

sql = "SELECT * FROM MessageToAll ORDER BY ID DESC"

Set rsMessage = Server.CreateObject("ADODB.RecordSet")
rsMessage.Open sql, g_ConnectionString

If NOT rsMessage.BOF AND NOT rsMessage.EOF Then
If Len(sResponse) > 0 Then sResponse = sResponse & "&"

sResponse = sResponse & "message=" &
Server.URLEncode(UCase((rsMessage.Fields.Item("MESSAGE").Value)))

sResponse = sResponse & "&message_found=true"
Else
' TODO: ---------------- Response.Write("login_done=Bad username /
password")
End If

If Len(sResponse) > 0 Then sResponse = sResponse & "&"

sResponse = sResponse & "detail_done=SUCCESS"

rsMessage.Close
Set rsMessage = NOTHING

Response.Write(sResponse)
%>

Re: Desparate help with CSS and ASP VBScript by mayayana

mayayana
Tue Jun 13 19:18:27 CDT 2006

You can use SPANs and DIVs with an assigned
class or ID, instead of the inline FONT tags.
That will make the page simpler to begin with.
It also gives you easy options for scripted
changes because every element has a style
property. So you can do things like:

<SPAN ID="span1">

Then in script you can do:

span1.style.fontSize = "12px"
span1.style.color = "#FF0000"

>
> trying to apply CSS to and ASP page as below but there is no page
structure,
> head / body etc. Tried various ways to add CSS but to no avail, cant even
> add font size to the ;<font color=""#FF0000"">" code.
>
> Anyone help??
>
> THIS IS THE ENTIRE CODE FORM PAGE - NEED TO APPLY STYLES TO sDetail
SECTION.
>
> <!--#include file="Vars.asp" -->
> <!--#include file="Functions.asp" -->
> <%
> ' Dim itm
> ' Response.Write("dashboard_done={{")
> ' For Each itm In Request.Form
> ' Response.Write(itm & " - " & Request.Form(itm) & ", ")
> ' Next
> ' Response.Write("}}")
> ' Response.End()
>
> Dim id
> Dim sql, rsBooking, rsMessage
>
> Dim sResponse
> sResponse = ""
>
> id = Request.Form("id")
> If Len(id) = 0 OR NOT IsNumeric(id) Then
> Response.Write("detail_done=ERROR")
> Response.End()
> End If
>
> ' rsBooking...
>
> sql = "SELECT * FROM booking_form WHERE ID=" + EncodeDbParam(id)
>
> Set rsBooking = Server.CreateObject("ADODB.RecordSet")
> rsBooking.Open sql, g_ConnectionString
>
> If NOT rsBooking.BOF AND NOT rsBooking.EOF Then
> Dim sDetail
>
> sDetail = sDetail & "<b>" & rsBooking.Fields.Item("VEHICLE_TYPE").Value
&
> _
> "</b> " & rsBooking.Fields.Item("JOURNEY_TYPE").Value &
"<br>"
>
> sDetail = sDetail & "Booking ref: <p class=""driver""><b>" & _
> rsBooking.Fields.Item("ID").Value & "</b></p>&nbsp;<font
> color=""#000066""><b>C/A</b></font>&nbsp;<font color=""#FF0000"">" &
> rsBooking.Fields.Item("ACCOUNT").Value & "</font></font><br>"
>
> sDetail = sDetail & "<span class=""driver"">" &
> FormatDateTime(rsBooking.Fields.Item("TimeOfBooking").Value, vbShortTime)
&
> _
> "</span></font>&nbsp;<font color=""#0066FF""><b>Price" &
> rsBooking.Fields.Item("MileageToDriver").Value & "</b></font><br>"
>
> sDetail = sDetail & "<font color=""#0066FF""><b>" &
> rsBooking.Fields.Item("TITLE1").Value & "&nbsp;" & _
> UCase((rsBooking.Fields.Item("PAX_NAME1").Value)) & "&nbsp;"
&
> UCase(rsBooking.Fields.Item("PAX_NAME2").Value) & "&nbsp;" & _
> rsBooking.Fields.Item("PAX_NAME3").Value & "&nbsp;" &
> rsBooking.Fields.Item("PAX_NAME4").Value & "</b></font><br>" & _
> "<font color=""#000000"">" & rsBooking.Fields.Item("MOBILE_NO").Value
&
> "</font><br>"
>
> sDetail = sDetail & "<font color=""#0066FF""><b>" &
> rsBooking.Fields.Item("COLL_AIRPORT_STATION").Value & "&nbsp;" & _
> rsBooking.Fields.Item("FLIGHT_NUMBER").Value & "&nbsp;" &
> rsBooking.Fields.Item("DEPARTING_FROM").Value & "<br>" & _
> rsBooking.Fields.Item("COLL_BUILDING_NAME_NO").Value & ",&nbsp;" & _
> rsBooking.Fields.Item("COLL_STREET").Value & "<br>" &
> rsBooking.Fields.Item("COLL_CITY_TOWN").Value & "<br>" & _
> rsBooking.Fields.Item("COLL_COUNTY").Value & "<br>" &
> UCase(rsBooking.Fields.Item("COLL_POST_CODE").Value) & "&nbsp;" & _
> rsBooking.Fields.Item("COLL_CONTACT_TEL").Value & "</b></font><br>"
>
> sDetail = sDetail & "<font color=""#FF6600""><b>" &
> rsBooking.Fields.Item("DEST_AIRPORT_STATION").Value & "<br>" & _
> rsBooking.Fields.Item("DEST_BUILDING_NAME_NO").Value &
"&nbsp;"
> & rsBooking.Fields.Item("DEST_STREET").Value & "<br>" & _
> rsBooking.Fields.Item("DEST_CITY_TOWN").Value & "<br>" &
> rsBooking.Fields.Item("DEST_COUNTY").Value & "<br>" & _
> rsBooking.Fields.Item("DEST_POST_CODE").Value & "</b></font> <font
> color=""#000000"">" & rsBooking.Fields.Item("DEST_CON_NUMBER").Value &
> "</font><br>"
>
> sDetail = sDetail & "<font color=""#000000"">" &
> rsBooking.Fields.Item("VIA_ROAD1").Value & "&nbsp;" & _
> rsBooking.Fields.Item("VIA_POST_CODE1").Value & "&nbsp;" &
> rsBooking.Fields.Item("VIA_ROAD2").Value & "&nbsp;" & _
> rsBooking.Fields.Item("VIA_POST_CODE2").Value & "&nbsp;" &
> rsBooking.Fields.Item("VIA_ROAD3").Value & "&nbsp;" & _
> rsBooking.Fields.Item("VIA_POST_CODE3").Value & "&nbsp;" &
> rsBooking.Fields.Item("VIA_ROAD4").Value & "&nbsp;" & _
> rsBooking.Fields.Item("VIA_POST_CODE4").Value & "</font><br><br>"
>
> sDetail = sDetail & "<font color=""#000000""><b>Journey
> Notes</b></font><br><font color=""#0000CC""><b>" &
> rsBooking.Fields.Item("SPECIAL_INSTRUCTIONS").Value & "<b></font>"
>
>
> If Len(sResponse) > 0 Then sResponse = sResponse & "&"
>
> sResponse = sResponse & "booking_detail=" & Server.URLEncode(sDetail)
> sResponse = sResponse & "&booking_found=true"
> Else
> ' sResponse = sResponse & "No journies assigned"
> End If
>
> rsBooking.Close
> Set rsBooking = NOTHING
>
>
> ' rsMessage ...
>
> sql = "SELECT * FROM MessageToAll ORDER BY ID DESC"
>
> Set rsMessage = Server.CreateObject("ADODB.RecordSet")
> rsMessage.Open sql, g_ConnectionString
>
> If NOT rsMessage.BOF AND NOT rsMessage.EOF Then
> If Len(sResponse) > 0 Then sResponse = sResponse & "&"
>
> sResponse = sResponse & "message=" &
> Server.URLEncode(UCase((rsMessage.Fields.Item("MESSAGE").Value)))
>
> sResponse = sResponse & "&message_found=true"
> Else
> ' TODO: ---------------- Response.Write("login_done=Bad username /
> password")
> End If
>
> If Len(sResponse) > 0 Then sResponse = sResponse & "&"
>
> sResponse = sResponse & "detail_done=SUCCESS"
>
> rsMessage.Close
> Set rsMessage = NOTHING
>
> Response.Write(sResponse)
> %>
>
>