# \[JavaScript\] Creating dynamic link function

**URL:** <https://forum.kirupa.com/t/javascript-creating-dynamic-link-function/258229>\
**Category:** web dev\
**Created:** [April 22, 2008, 9:04am UTC](https://forum.kirupa.com/t/javascript-creating-dynamic-link-function/258229 "2008-04-22T09:04:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ordinathorreur](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ordinathorreur/32/536_2.png) [@Ordinathorreur](https://forum.kirupa.com/u/Ordinathorreur)\
**Post date:** [April 22, 2008, 9:04am UTC](https://forum.kirupa.com/t/javascript-creating-dynamic-link-function/258229/1 "2008-04-22T09:04:39Z")

</div>

Hi guys, I’m trying to write my first custom bit of JavaScript, and Im not doing very well ha ha… Yeah, Im a total JS noob, so right now Im trying to create ActionScriptified-JavaScript 😉

I want to call a function from Flash, passing a variable, and then fill the contents of an empty div with the dynamic link. This is what I have so far, but Im having a bit of trouble…

My function:

function showDynamicLink(number){  
var link:String = “\<a href=’/view/” + number.toString() + “’ \>View\</a\>”;  
document.getElementById(‘divToReplaceContentOf’).innerHTML = link;  
}  
showDynamicLink(86);
