function windowFactory( args, html ) { var argstr = “”; for (feature in args) { if (typeof args[feature] == “bool”) argstr += feature + “=” + (args[feature] ? “yes” : “no”) + “,”; else argstr += feature + “=” + args[feature] + “,”; } argstr = argstr.substr(0,argstr.length-1); var windowRef = window.open(“”, “_blank”, argstr); setTimeout(function() { if (windowRef) { windowRef.document.write(html); windowRef.document.close(); }}, 1000); return false; } function openCustomWindow() { var myHTML = “ < html > < body > < h1 > Hi There < /h1 > < p > Thanks for visiting! < /p > < /body > < html > ”; return windowFactory({status:false,titlebar:false, width:500, height:300}, myHTML); } < /script > < a href=”#” οnclick=”return openCustomWindow()” > Thanks for visiting! < /a >
为了去掉中文的双引号,弄了个转换的小程序,复习了下java流的引用
import java.io.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class ReadFiles { public static void main(String[] args) { File f = new File("C:\\Users\\nakesa\\Desktop\\jsTest\\7.txt"); File f1 = new File("F:\\bak\\8.txt"); Pattern p = Pattern.compile("“|”"); Matcher m = null; Reader re = null; //Writer we = null; FileOutputStream we = null; int c; String str = ""; try { //re = new InputStreamReader(new FileInputStream(f),"UTF-8"); //we = new OutputStreamWriter(new FileOutputStream(f1),"gbk"); we = new FileOutputStream(f1); re = new InputStreamReader(new FileInputStream(f),"gbk"); byte[] buff = new byte[]{}; while((c = re.read()) != -1) { m = p.matcher(String.valueOf((char)c)); str = m.replaceAll("\""); //we = new OutputStreamWriter(new FileOutputStream(f1)); buff = str.getBytes(); we.write(buff,0,buff.length); System.out.print(str); } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }