Index: lams_central/web/includes/javascript/common.js =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/includes/javascript/common.js,v diff -u -r1.1 -r1.2 --- lams_central/web/includes/javascript/common.js 13 Sep 2005 04:15:36 -0000 1.1 +++ lams_central/web/includes/javascript/common.js 20 Dec 2005 04:00:21 -0000 1.2 @@ -15,4 +15,25 @@ instructionsWindow = window.open(url,'instructions','resizable,width=796,height=570,scrollbars'); instructionsWindow.window.focus(); // } + } + + function filterData(src,target){ + if(src.value != null){ + //replace specified string for characters that are sensitive to HTML interpreters + var srcV = src.value; + //must replace & first, otherwise, this will conflict with others. + srcV = srcV.replace(/&/g,"&"); + srcV = srcV.replace(//g,">"); + srcV = srcV.replace(/"/g,"""); + srcV = srcV.replace(/\\/g,"'"); + target.value = srcV; + //for windows system + if(src.value.indexOf("\r\n") != -1) + target.value=srcV.replace(/\r\n/g,"
"); + //for *nix system + else if(src.value.indexOf("\n") != -1) + target.value=srcV.replace(/\n/g,"
"); + + } } \ No newline at end of file