The code-application technique of implementing code running function with replace and non-regular under ASP

Source: Internet
Author: User
Today updated the blog's code to run the function, because the original writing is not perfect, if you want to insert a blog in a number of operational code, it will-er fart. With regard to the Replace function, JS simply replaces the first specified string from the starting position. And the VBS replaces all the specified strings, so if you want to replace them with a VBS, you have to go around a bend, write a function, and, by the way, upload the function that you've finished. This can be put in a log a number of code to run the demo!

Have a cold, write function to go to bed obediently, today live really hard, kind of dying feeling ... With a paper regiment in his nose, because snot can't stop flowing, woo
The code for the replacement function is as follows:
<textarea id="runcode92426"><script language= "vbs" > Function ubbtohtml (str,tag) Dim Length,temparray,i,tempstr = "" "Temparray = Split (str," [/"&tag&]") length = UBound (temparray)-1 for i=0 to Lengt H tempstr = tempstr & Replace (Temparray (i), "[" &tag& "]", "<div class= ' code ' ><div clas s= ' Codetitle ' > Source code </div><div id= ' code ' &i& ' ' class= ' code_content ' > ') tempstr = Temp STR & "</div></div><div><input type= ' button ' value= ' Run code ' onclick= ' Preview (" Codes "&i & "" ""/></div> "& Chr (Next tempstr = TempStr &" "& Temparray (length+1) ubbtohtml = TempStr End Function ' ========== function uses ======== Dim test test = ubbtohtml ("00000 [Code]code1[/Co De]pg1[code]code2[/Code]PG2 "," code ") </script></textarea>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]


<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <title></ title> </pead> <body> <script type= "Text/javascript" > <!--alert ("Test1"); --> </script> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]


<!doctype HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" " Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <title></title> </pead> <body> <script type= "Text/javascript" > <!--al ERT ("Test2"); --> </script> </body> </ptml>

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.