# Calling javascript

**URL:** <https://forum.kirupa.com/t/calling-javascript/243479>\
**Category:** Uncategorized\
**Created:** [November 7, 2007, 2:48pm UTC](https://forum.kirupa.com/t/calling-javascript/243479 "2007-11-07T14:48:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sketchie](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@sketchie](https://forum.kirupa.com/u/sketchie)\
**Post date:** [November 7, 2007, 2:48pm UTC](https://forum.kirupa.com/t/calling-javascript/243479/1 "2007-11-07T14:48:22Z")

</div>

Hi all, I’m in need of a little help…

I’ve written this little javascript:

```auto

<script type="text/javascript">
var myvar;
function barkie() {
  document.getElementById('barkie1').style.display = 'none';
  document.getElementById('barkie2').style.display = 'none';
  document.getElementById('barkie3').style.display = 'none';
}
function showBarkie (i) {
  barkie();
  if (myvar == i) {
        document.getElementById(i).style.display = 'none';
        myvar = '';
    }
  else {
        document.getElementById(i).style.display = 'block';
        myvar = i;
    }
}
</script>

<body onload="barkie();">

```

Simply what this code does; it makes all divs invisible.  
So when I use click, the div Barkie 1 appears correctly.

Now my problem is that I want my swf to be calling the javascript.

In flash 8 I made a button called launchScript and on frame 1 I put this Actionscript:

```auto

launchScript.onRelease = function() {
    getURL("javascript:showBarkie('barkie1')");
}

```

When I click the button in my browser, nothing happens.  
Also I’ve tried doing it with on(release) … directly on the button, but here also nothing happens.

I did check google on this and so far I’ve found stuff about ExternalCall or something, but I’m 100% sure That calling a javascript from a swf does work with a ‘basic’ getUrl.

Someone here who could help me with this?
