| 广告招租,e-mail:yesize@hotmail.com
|
|
广告招租,e-mail:yesize@hotmail.com
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>html转js转jsp(或servlet)</title> <style type="text/css"> <!-- body { font-size: 12px; text-align: center; margin: 0px; border: none; background-color: #CCCCCC; } --> </style> </head> <body scroll=no> <script> function html2js(codestr){ var codes=codestr.split("\n"); var jscode=""; var tcode=""; for(var a=0;a<codes.length;a++){ if(codes[a].replace(/\s+/,"")!=""){ tcode=""; tcode+=codes[a].replace(/\"/ig,"\\\\\\\"").replace(/(\s+)</ig,"<").replace(/\//ig,"\/"); tcode="out.println(\"document.write(\\\""+tcode+"\\\");\");\n"; jscode+=tcode.replace(/\r/ig,""); //alert(jscode); } } jscode="out.println(\"<script language=\\\"javascript\\\">\");\n"+jscode+"out.println(\"<\/script>\");"; return jscode; } function runcode(){ var mywin=window.open("","测试窗口","") mywin.document.open(); mywin.document.write(jscode.value); mywin.document.close(); } </script> <textarea name="htmlcode" style="width:100%" rows="15" id="htmlcode"></textarea> <input type="button" name="Submit" value=" 转 换 " onClick="jscode.value=html2js(htmlcode.value)"> <input type="button" name="Submit2" value=" 测 试 " onClick="runcode()"> <br> <textarea name="jscode" style="width:100%" rows="15" id="jscode"></textarea> <br> </body> </html>
版权说明:作品来源于网上,版权归作者所有,如果无意中侵犯了您的版权,请来信告知,本站将在3个工作日内删除。yesize@hotmail.com |
|