Click to See Complete Forum and Search --> : Posting code on a web page
bsmith
Jun 19th, 2000, 11:31 PM
I want to display some vbscript code in an asp page. I want the code to be formatted as it is in the file and colored as it is when code is posted here. Can someone help me with this?
Thanks
highlife
Jun 20th, 2000, 01:03 AM
you are talking about displaying the formatted vb code in the browser right?
if so one way would be to write a CSS for the page and apply it to the code
Not gonna work highlife... cascading stylesheets work on tags... you would have to put one kinda tag around each keyword and have a reference to that in the css...then do the same for all the numbers, then for all the strings, then all the errors, then all... too much like hard work!
You could use the one that's on this bb ... write a message and hit the preview button, then rip off the code... I did that once but you have to spend so long ripping out unneeded code that it's really not worth it.
You might as well just spend a bit of time putting the appropriate <font> tags around all the code.
Better still write a search and replace algorithm that replaces all the:
Dim
with:
<font color="navy">Dim</font>
and so on...then make it put:
<font face="courier new">
tags around the whole lot... might take a while to write but the end result would be useful :)
Might even do that myself...nah, can't be bothered :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.