Javascript on slamlink.net!

posted in: Daily Update | 0

Overview:

  1.  I spent several hours today figuring out how to get javascript to work with my website
  2. Changed all the Code_Title ID’s to classes because it was appropriate. I should have also reduced all the inline css to the external css but I decided to just leave it alone

Comments:

I’m currently using a child theme so I was unsure how I can follow the steps in this link: http://codex.wordpress.org/Using_Javascript because I did not have the header php. I found out that I had to create a whole new header php but I had to access my database from goDaddy to do so. I followed this link: http://support.godaddy.com/help/article/104/connecting-to-your-hosting-account-with-filezilla-ftp step by step to use filezilla to create a new header php file and also upload my javascript file.

After creating a javascript and header.php file. I simply added this code:

<script type="text/javascript" src="/scripts/emailpage.js"></script>

but modified the src to fit my situation. I created two buttons using the element tag: <button onclick=”show(‘id_of_paragraph’)”>Show me </button> and the same button but with a hide function. These two buttons will be used to hide and show my code so that my web pages are not filled with massive amounts of text. The code for the show and hide function is below:

function hide(name)
{
document.getElementById(name).style.display=”none”;
}

function show(name)
{
document.getElementById(name).style.display=”block”;
}

Leave a Reply