So this is what my Javascript looks like:
function open_box(message){
var box_content = '<div id="overlay"><div id="box_frame"><div id="box">'+message+'<a href="javascript:reset_frame()"><div id="xbutton"><img src="elements/xbutton.png"></div></a></div></div></div>';
document.getElementById('functioner').innerHTML = box_content;
open_box('Why hello there');
}
When I fill in the 'Why hello there' parameter in my JS file, it prints just like it should in HTML. For all intents and purposes, the function works. The only problem is that it takes quite a while to load. To the point where sometimes my browser asks to stop the operation. Can anyone explain to me why this is? Any potential avenues for optimization?
EDIT: I see your guys' point about recursion. Looking back at it, it makes sense. This leads me to another problem.
When moved directly outside the function, my HTML doesn't acknowledge my 'why hello there' parameter. The code that is meant to call it is just a simple <a href="javascript:open_box()">
.
I'm still trying to get into the hang of calling JS code, so excuses for the newbie mistake.