Site icon Hip-Hop Website Design and Development

Custom field in external Javascript

How do I use a custom filed value in an external javascript?
I’d like to use a custom field already stored for a post that is an url in an external javascript

<script type='text/javascript' src='http://www.my-website.com/wp-content/themes/mytheme/js/scripts.js'></script>

in order to open a new window

onclick="window.open('MY_CUSTOM_FIELD_VALUE');"

I tried to add

global $post; $cf = get_post_meta( $post->ID, 'my_custom_field', true );

but it doesn’t work.
Thanks for your help.