If I had a js file that I wanted to protect, couldn't I just write some javascript code that would reference my js file. Then I could scramble the 1st code so that references and the location could not be seen to the 2nd js file.
Here is what I have, but can't get it to work. It works when I have it embeded, but can't get the first code to work when I break them up.
1st code- embeded in the html, which I want to scramble
2nd code "convertSpaces.js" - is a js file sitting on the server
The way it is supposed to work is->
when you type into the text box, it removes the spaces ect. when you click out.
Any help is appreciated,
Thanks
tav
Here is what I have, but can't get it to work. It works when I have it embeded, but can't get the first code to work when I break them up.
1st code- embeded in the html, which I want to scramble
Code:
<script language="JavaScript"><!--
document.write('<script src="convertSpaces.js"><\/' + script>');
//--></script>
2nd code "convertSpaces.js" - is a js file sitting on the server
Code:
function convertSpaces(str)
{
str=str.replace(/\r/g,"")
str=str.replace(/\s/g,",")
str=str.replace(/\,,*/g,",")
str=str.replace(/\''*/g,"")
str=str.replace(/(,*),$/,"$1")
str=str.replace(/(,*),$/,"$1")
str=str.replace(/(,*),$/,"$1")
str=str.replace(/(,*),$/,"$1")
str=str.replace(/(,*),$/,"$1")
str=str.replace(/(,*),$/,"$1")
str=str.replace(/(,*),$/,"$1")
str=str.replace(/\,,*/g,"','")
str=str.replace(/^','/g,"")
return str;
}
Code:
<textarea name="user" rows="10" cols="35" onBlur="this.value = convertSpaces(this.value);countWords(this.value);"></textarea>
The way it is supposed to work is->
when you type into the text box, it removes the spaces ect. when you click out.
Any help is appreciated,
Thanks
tav