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>