Where;s better way using javascript link or write inside htm ?
I thought it's more good inside a html/php since
the code sometimes doesnt loaded when using link.
It's better to separate scripts from your (X)HTML page (like you separate style from content).
It's easier to maintain, it's faster to load for users (since they don't have to download it each time), and you'll avoid some IE bugs.
yeah, separate the javascript from your (x)html... this is called unobtrusive javascript. Moreover, try to separate javascript (behavior), css (style) and html (content)... you'll have everything separated and clean...
also, take a look at the behavioral separation article from A List Apart...
oh isee thanks,
is there a way to encrypt the javascript files ?
I guess there's no way you can encrypt javascript in just plain HTML. You could encrypt the code using PHP and output the code using PHP, but it is impossible to use one-way encryption and thus other people might still be able to steal your code.
| Philip wrote: |
| is there a way to encrypt the javascript files ? |
Just try to understand : if you encrypt your javascript files, the browsers won't be able to open it and tu execute the javascript code. Quite useless...
On the other hand : if the browser is able to read the javascript files, everobody can.
then is there a way to programming javascript hard to see the script ?
There is no absolute way to prevent others from stealing your code. You can actually make the script hard to read for others (like dumping all your Javascript code into one line) but it will also make it hard for yourself to edit the script.