# External js issues - Please suggest ideas

**URL:** <https://forum.kirupa.com/t/external-js-issues-please-suggest-ideas/311658>\
**Category:** web dev\
**Created:** [July 13, 2010, 4:38pm UTC](https://forum.kirupa.com/t/external-js-issues-please-suggest-ideas/311658 "2010-07-13T16:38:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sde\_sal](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@sde\_sal](https://forum.kirupa.com/u/sde_sal)\
**Post date:** [July 13, 2010, 4:38pm UTC](https://forum.kirupa.com/t/external-js-issues-please-suggest-ideas/311658/1 "2010-07-13T16:38:28Z")

</div>

Hi All,

I had a issue with converting an inline js function to external file , I know it is pretty dumb question, But would really appreciate if you guys can help me in solving it.

Steps - I cut the script function from a file and pasted in a newly created .js file.

and then i added a reference -  
\<script type=“text/javascript” src="/test/js/my.js"\>\</script\>

My myscript contains a var shareMenu which is actully used in following.

External Script Contents - There is no script tag  
var shareMenu = new Array();  
shareMenu[0] = '\<a target="\_blank" href=…\>

I am using using my shareMenu var in page as -  
\<a href="##" rel=“nofollow” onClick=“return dropdownmenu(this, event,\*\* shareMenu\*\*, ‘150’)” onMouseout=“delayhidemenu()”\>

Whenever i debug - it gives me error - shareMenu undefined

To solve this i added a path in \<a target ="/test/js/my.js"… \> But it doesnt work as well. Is there any other way to use the external js var ?

Please suggest with some ideas.
