a.js:
var x = 'abc';
b.js:
alert(x);
HTML:
<script src="http://site1.ru/a.js"></script>
<script src="http://site2.ru/b.js"></script>
С чем возникли сложности? Почитай еще про JSONP.