Forum Moderators: open
and this writes test on the current page where I want it to go. My problem is that when I try and call a function and write it to this same spot it writes it to another page instead of writing it to where the code is placed into the body of the document. The function is this:
function getBC(div_name)
{
document.write(div_name);
}
It gets its argument from this function call:
getBC('Retirement');
I can't figure out why it would write it to a different page instead of where I want it to go in the body of the document like just writing document.write('test') like it was without the function. Anyone have any ideas?
<span ID="bc">Health</span>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getBC(div_name) {
document.getElementById("bc").innerHTML = div_name;
}
// -->
</SCRIPT>
Now I would like to make the div_name into a link. This is what I tried but it is giving me an error:
<span ID="bc">Health</span>
<SCRIPT LANGUAGE="JavaScript">
<!--
function getBC(div_name) {
document.getElementById("bc").innerHTML = '<a href = http:\/\/www.yahoo.com/>'.div_name.'</a>';
}
// -->
</SCRIPT>
Any more ideas?