javascript - I want to pull a variable from a jscript file to provide the href value in an <a> tag -


i'm front-end web designer, dabble in javascript etc. i've been googling (i'm not @ jscript, can figure out 75% of time); i've been able find how create variables within html, isn't helpful. i've defined variable makes use of value function in linked jscript file has created.

so ideally:

<script src="myjscriptfile.js" language="javascript"></script>  <a href="nameofvarfromfile" >the file!</a> 

i'm trying pull url of pdf file, , use url in object embedded in page. figured simpler way ask question , same result.

you'll need reference javascript variable from javascript, , set link's href there.

<a href="#" id="linktoset">the file!</a>  <script src="myjscriptfile.js" language="javascript"></script> <script>   document.getelementbyid('linktoset').href = nameofvarfromfile; </script> 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -