请教ASP程序中,实现自定义字体颜色、字体及部分HTML代码的思路是什么?

c9394 2001-07-27 12:10:22
请教ASP程序中,实现自定义字体颜色、字体及部分HTML代码的思路是什么?
...全文
913 点赞 收藏 5
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
c9394 2001-07-29
加分。
回复
xds2000 2001-07-27
专家在此,还不给分:
<IMG SRC="../images/h_samples.gif" border=0 width=186 height=50 alt="Samples">
<% HR %>

<%
Sub WriteTableRow(sFileName, sSampleName, sSampleDesc, iRating, bNew, bASPX)
Dim I 'As Integer
Response.Write "<tr>" & vbCrLf
Response.Write vbTab & "<td><a href=""" & sFileName & """>" & sSampleName & "</a></td>" & vbCrLf
Response.Write vbTab & "<td>" & sSampleDesc
If bNew Then Response.Write "  <img src=""../images/new.gif"">"
Response.Write "</td>" & vbCrLf

Response.Write vbTab & "<td align=""center"">"
If bASPX Then
Response.Write "<a href=""" & Replace(sFileName, ".asp", "_aspx.asp") & """><img src=""./images/aspx_indicator.gif"" width=""58"" height=""26"" border=""0""></a>"
Else
Response.Write " "
End If
Response.Write "</td>" & vbCrLf

Response.Write vbTab & "<td>"
For I = 1 to iRating
Response.Write "<img src=""./images/vbscript.gif"" width=""22"" height=""26"">"
Next 'I
Response.Write "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
End Sub
%>

<TABLE BORDER=0>
<TR>
<TD ALIGN="center">
<A HREF="./viewasp.asp?file=index.asp">
<IMG SRC="./images/viewasp.gif" WIDTH=50 HEIGHT=32 BORDER=0 ALT="ASP"></A>
</TD>
<TD>
Wherever you see this image you can click on it to see
the actual ASP code that generated the corresponding page.
So it stands out, ASP code is displayed as
<FONT COLOR=#0000FF>blue text</FONT> and ASP comments are
<FONT COLOR=#009900>green text</FONT>.
</TD>
</TR>
<TR>
<TD ALIGN="center">
<A HREF="./viewhtml.asp?file=index.asp">
<IMG SRC="./images/viewhtml.gif" WIDTH=50 HEIGHT=32 BORDER=0 ALT="HTML"></A>
</TD>
<TD>
Likewise where you see this image you can click on it to
see a previously run sample of HTML that was generated by
the script.
</TD>
</TR>
<TR>
<TD ALIGN="center">
<A HREF="./download.asp?file=index.asp">
<IMG SRC="./images/download.gif" WIDTH=86 HEIGHT=32 BORDER=0 ALT="HTML"></A>
</TD>
<TD>
Due to popular demand, when you click on this image, you'll
get a plain text version of the script. You can either save
the whole file or cut and paste it directly into your own script!
</TD>
</TR>
<TR>
<td align="center" valign="top"><br /><img src="./images/aspx_indicator.gif" WIDTH=58 HEIGHT=26 BORDER=0 ALT="ASP.NET"></td>
<td>
In order to begin introducing our users to some of the exciting new
features and coding style of ASP.NET, we're publishing ASP.NET versions
of a number of our existing samples which will be indicated by
this symbol. We feel the benefits to this approach are two-fold.
<ol>
<li>You get some explosure to ASP.NET code (obviously)</li>
<li>You get to compare the two sets of code and see the differences for yourself</li>
</ol>
</td>
</TR>
</TABLE>

<br />

<table border="10" cellspacing="0" cellpadding="1" bordercolor="#33CC33" bordercolorlight="#00CC66" bordercolordark="#006600">
<tr bgcolor="#009900">
<td bgcolor="#009900"><font color="#FFFFFF"><b>Sample Name</b></font></td>
<td bgcolor="#009900"><font color="#FFFFFF"><b>Description</b></font></td>
<td bgcolor="#009900"><font color="#FFFFFF"><b>ASP.NET</b></font></td>
<td bgcolor="#009900"><font color="#FFFFFF"><b>Complexity</b></font></td>
</tr>
<%

WriteTableRow "db_xml.asp", "ADO to XML", "Save a recordset as an XML file using ADO.", 1, False ,False
WriteTableRow "array.asp", "Array (1D)", "Sometimes one value per variable just isn't enough.", 1, False ,False
WriteTableRow "bar_chart.asp", "Bar Chart", "Turn those numbers into something useful!", 2, False ,False
WriteTableRow "calendar.asp", "Calendar", "Darn, what day is my birthday on in 2010? I need to start planning!", 3, False ,False
WriteTableRow "case.asp", "Cases", "Demonstrates how to create and select a Case.", 1, False ,False
WriteTableRow "checkbox.asp", "Checkbox", "Find out how to handle checkboxes like a pro.", 1, True ,False
WriteTableRow "colors.asp", "Colors", "All the colors of the (color-safe palette) rainbow.", 2, False ,False
WriteTableRow "cookie.asp", "Cookies", "No cookie monsters here.", 1, False ,True
WriteTableRow "db_simple.asp", "Simple Database", "Uses info from a database table to build an HTML table.", 1, False ,False
WriteTableRow "database.asp", "Database", "Accessing an Access database.", 2, False ,True
WriteTableRow "db_add.asp", "Database Add", "Part 1 of our DB editing trilogy: Add!", 1, False ,False
WriteTableRow "db_del.asp", "Database Delete", "Part 2: The Delete Strikes Back!", 1, False ,False
WriteTableRow "db_update.asp", "Database Update", "Part 3: Return of the Update!", 1, False ,False
WriteTableRow "db_count.asp", "Database Count", "How to get a RecordCount that doesn't return -1!", 2, False ,False
WriteTableRow "db_edit.asp", "Database Editing", "Add, delete, and edit from one script.", 3, True ,False
WriteTableRow "db_getrows.asp", "Database GetRows", "Get all your recordset rows at once!", 2, False ,False
WriteTableRow "db_getstring.asp", "Database GetString", "No more looping through recordsets!", 2, False ,False
WriteTableRow "db_paging.asp", "Database Paging", "Previous 10, Next 10... you know you want it!", 2, False ,False
WriteTableRow "db_pulldown.asp", "Database Pulldown", "Fill your pulldowns with data from a Database!", 2, False ,False
WriteTableRow "db_search.asp", "Database Search", "Perform a simple text search on a database.", 2, False ,False
WriteTableRow "db_paged_search.asp", "Database Paged Search", "Two cool DB scripts rolled into one!", 3, False ,False
WriteTableRow "dir_list.asp", "Directory List", "Directory browsing made pretty!", 2, False ,False
WriteTableRow "dir_list_sort.asp", "Directory List (Sorted)", "Sort the results of our Dir List script.", 3, False ,False
WriteTableRow "email.asp", "E-mail", "How to send an e-mail message from your web server using CDO.", 1, False ,True
WriteTableRow "email_html.asp", "E-mail (HTML)", "Send email messages as lively as a web page.", 1, False ,False
WriteTableRow "elseif.asp", "ElseIf", "No, it's not a typo...", 1, False ,False
WriteTableRow "xl_data.asp", "Excel Data", "There actually are reasons why you'd want to do this!", 2, False ,False
WriteTableRow "form_handler.asp", "Form Handler", "Some light form validation and error notification.", 2, False ,True
WriteTableRow "form_to_db.asp", "Form to DB", "Insert records retrieved from a form into a database", 2, False ,False
WriteTableRow "function.asp", "Functions", "A basic use of a function that can save redundant code.", 1, False ,False
WriteTableRow "getpost.asp", "Get vs. Post", "The age-old debate examined via ASP.", 1, False ,False
WriteTableRow "welcome.asp", "Greeting", "Greet your user based on the time of day.", 1, False ,False
WriteTableRow "guestbook.asp", "Guestbook", "Let your guests sign in.", 2, False ,False
WriteTableRow "hangman.asp", "Hangman", "Just hanging around!", 3, False ,False
WriteTableRow "world.asp", "Hello World", "The classic beginning script for any language implemented in ASP.", 1, False ,False
WriteTableRow "counter.asp", "Hit Counter", "Count hits to your pages.", 1, False ,False
WriteTableRow "counter_db.asp", "Hit Counter (DB)", "Another hit counter, but using a database instead of text files.", 1, False ,False
WriteTableRow "http.asp", "Http Request", "Sometimes it's helpful to get data from other servers... here's how.", 2, False ,True
WriteTableRow "modified.asp", "Last Modified", "Get the last modified date from your ASP files.", 2, False ,False
WriteTableRow "links.asp", "Link Manager", "Manage the links on your page from your browser!", 3, False ,False
WriteTableRow "login.asp", "Login & Password", "Secure an ASP page simply and easily.", 2, False ,False
WriteTableRow "min-max.asp", "Min / Max", "The highs and lows of ASP coding!", 2, False ,False
WriteTableRow "multiple_selection.asp", "Multiple Selections", "Why limit your users to one choice... let em choose away!", 1, False ,False
WriteTableRow "output.asp", "Output", "Response.Write, Carriage Returns, vbCrLf, and more fun stuff!", 1, False ,False
WriteTableRow "time.asp", "Page Timer", "How long are people spending filling out your forms?", 2, False ,False
WriteTableRow "phonemsg.asp", "Phone Message", "A virtual "While You Were Out" pad.", 2, False ,False
WriteTableRow "phone_format.asp", "Phone Number", "Format your phone numbers so they're all uniform.", 1, False ,False
WriteTableRow "polls.asp", "Poll", "Poll your users. It's like the quiz, but it's not!", 3, False ,False
WriteTableRow "pcase.asp", "Proper Case", "There's LCase and UCase... and now PCase!", 1, False ,False
WriteTableRow "pulldown_nav.asp", "Pulldown Navigation", "Navigate around your site using a pulldown box!", 2, False ,False
WriteTableRow "quiz.asp", "Quiz", "Test your visitors' knowledge!", 3, False ,False
WriteTableRow "radiobutton.asp", "Radio Button", "Why they're called radio buttons we'll never know.", 1, True ,False
WriteTableRow "random_number.asp", "Random Number", "Generate a random number using ASP.", 1, False ,False
WriteTableRow "random_image.asp", "Random Image", "Not 1 or 2, but 3 ways to display a random image!", 2, False ,False
WriteTableRow "servvars.asp", "Server Variables", "Find out what your clients are telling you.", 1, False ,False
WriteTableRow "shopping.asp", "Shopping Cart", "Let's go shopping. Cool ASP 101 merchandise!", 3, False ,False
WriteTableRow "source.asp", "Source Code", "View source code of the script that lets you view our source code.", 2, False ,False
WriteTableRow "tell_a_friend.asp", "Tell a Friend", "Have users tell their friends about a resource on your site.", 2, False ,False
WriteTableRow "textfile.asp", "Text Files", "Learning to read and write all over again.", 2, False ,False
WriteTableRow "db_dsn.asp", "Universal DB Viewer", "View any database on the web. Just plug in your DSN and go!", 3, False ,False
WriteTableRow "url_linker.asp", "URL Linker", "Automatically link every http:// in a string", 1, False ,False
WriteTableRow "var_types.asp", "Variable Types", "Type mismatch?... but I thought everything was a variant.", 2, False ,True
WriteTableRow "wordcount.asp", "Word Count", "Counts the words and characters in a string.", 1, False ,False
WriteTableRow "y2k.asp", "Year 2000", "If the cookie monster didn't scare you this should.", 1, False ,False
%>
</table>

<br />

<p>
These samples are placed here for your reference.
Each one will give you sample output, the .asp source file,
and the .htm file that is generated when a user runs the .asp
script. This code is strictly for the sake of illustration.
Most of it includes little to no error handling and we therefore
cannot be held responsible for anything it may do when run on
your server.
</p>
<p>
Having said that, we will not intentionally place any malicious
code here and will try and warn you of anything a script may do
which might be unexpected (ie. writing to the server's hard drive).
Still, if you do encounter any errors or side effects when attempting
to run any of our code, please let us know and we'll do our best to
assist you in getting it to run correctly and update our example
with the appropriate fix and/or warning.
</p>
<!--<p>Wheh! Now to the fun part .... the code.</p>-->
<p>
For those of you who keep asking if you can use the code
<a href="license.asp">read this</a>.
</p>

实现后页面为asp说明为绿色,代码为蓝色。
回复
zken 2001-07-27
response.write 你想用的字体颜色设置的html
回复
孟子E章 2001-07-27
<font color=red>sssssss</font>
回复
tripofdream 2001-07-27
在写到页时把这部分内容替换成相应的HTML标记
回复
相关推荐
发帖
ASP
创建于2007-09-28

2.8w+

社区成员

ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
申请成为版主
帖子事件
创建了帖子
2001-07-27 12:10
社区公告
暂无公告