Putting Javascript Tool in WordPress Post
-
Hoping I can get some help – I don’t know much (or anything) about code, but I am trying to create a name generator tool for my website.
I found a free piece of code that allowed me to download a name generator javascript code and then cut and pasted names I wanted to generate. I saved the code as a name-generator.js and uploaded it to the root domain of my website.
I read in the Using Javascript codex that when you want to use javascript on one specific page/post, you put this in:
<script type="text/javascript" src="/scripts/updatepage.js"></script> <script type="text/javascript"> <!-- updatepage(); //--></script>I did this in my post, replacing “updatepage.js” with “name-generator.js” but nothing shows up.
I also do not understand when the codex says
Make sure that each script is defined by its function name, such as:
function updatepage(){var m="Page updated "+document.lastMo.......}The function used in my javascript is:
function generator()
so I replaced the “updatepage()” with “generator()” but I do not know if that makes sense.Thank you so much, I’m sorry, really no idea what I am doing!
The topic ‘Putting Javascript Tool in WordPress Post’ is closed to new replies.