document.write
will blank out your entire page if it is called after the page loads. You probably want to use innerHTML
instead.
function articlePopUp( title , content) {
htmlContent = '';
htmlContent += '<div class="backgroundFade"></div>';
htmlContent += '<div class="articlePosition"><div class="closeArticle">Close</div>';
htmlContent += '<div class="articleRead">';
htmlContent += '<h1>';
htmlContent += title;
htmlContent += '</h1>';
htmlContent += '<div class="grey-line"></div>';
htmlContent += content;
htmlContent += '</div></div>';
return htmlContent;
}
function articleRead ( title, content) {
document.getElementById("aID").innerHTML = articlePopUp(title,content);
}