How to implement HTML highlighting code using Syntaxhighlighter _javascript Tips

Source: Internet
Author: User
Http://www.jb51.net/jiaoben/15599.html
Syntaxhighlighter is a small open source project that highlights the various program source code syntax in a Web page. Support the various programming languages currently in vogue:
C #, CSS, C + +, Delphi, Java, JavaScript, PHP, Python, Ruby, SQL, Visual Basic, xml/html
How to use:
1, assuming that the Web page file test.htm stored in a directory, the Dp.syntaxhighlighter will be extracted to the subdirectory under the directory, assuming that images

2, insert the following code between the
Copy Code code as follows:

<link type= "Text/css" rel= "stylesheet" href= "Images/styles/syntaxhighlighter.css" ></link>

3, in the page to display the source code of the program to insert the following code (of which the class= "JS" indicates the source code in JS syntax, other can be set the class values are
C #, CSS, C, Delphi, Java, JS, PHP, Python, Ruby, SQL, VB, xml:
Copy Code code as follows:

<textarea name= "code" class= "JS" rows= "cols=" >
The program source code is here.
</textarea>


4. Insert the following code before </body> at the end of the page:
Copy Code code as follows:

<script class= "javascript" src= "Images/scripts/shcore.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushcsharp.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushphp.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushjscript.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushjava.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushvb.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushsql.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushxml.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushdelphi.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushpython.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushruby.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushcss.js" ></script>
<script class= "javascript" src= "Images/scripts/shbrushcpp.js" ></script>
<script class= "JavaScript" >
Dp. Syntaxhighlighter.highlightall (' Code ');
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.