引入google插件js,这里使用的是version1.5.1,至于为什么没有使用最新版version3.0.8已经忘记了
<!--SyntaxHighlighter-->
<link href="../../js/SyntaxHighlighter_1.5.1/styles/SyntaxHighlighter.css" rel="stylesheet" type="text/css"/>
<script src="../../js/SyntaxHighlighter_1.5.1/scripts/shCore.js" language="javascript"></script>
<script src="../../js/SyntaxHighlighter_1.5.1/scripts/shBrushXml.js" language="javascript"></script>
html如此:
<pre name="response" id="response" class="xml">
<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap
/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001
/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><SOAP-ENV:Body><m:CheckReservations
xmlns:m="http://webservices.hotel.de/MyRES/V1_1"><m:objRequest><m:WebServiceConsumerID>110</m:WebServiceConsumerID
><m:WebServiceConsumerPassword>!c4r75n)/</m:WebServiceConsumerPassword><m:Token>123456</m:Token><m:Reservation_StartDateTime
>2011-02-28T00:00:00.0Z</m:Reservation_StartDateTime><m:Reservation_EndDateTime>2011-03-01T23:59:59.59Z
</m:Reservation_EndDateTime><m:PropertyNumbers><m:int>126621</m:int></m:PropertyNumbers><m:ReservationSearchMethod
>ByReservationDate</m:ReservationSearchMethod></m:objRequest></m:CheckReservations></SOAP-ENV:Body><
/SOAP-ENV:Envelope>
</pre>
调用高亮显示 name="response" 的内容(此处一定是name)
dp.SyntaxHighlighter.HighlightAll('response');