jmh722
07-07-2005, 04:21 PM
My Problem:
Right now, what I am trying to make happen is whenever a link is pressed, I want function getText(a) to write new text
into the id element “cont” via showPic(), how do I do that?
I’m stumped...
//variables
var jan = "The traditional birthstone for January is Garnet”;
var feb = "The traditional birthstone for February is Amethyst”;
//Javascript
function getText (a) {
document.write(a)
}
function showPic (whichpic, content) {
if (document.getElementById) {
document.getElementById('placeholder').src = whichpic.href;
if (whichpic.title) {
document.getElementById('cont').childNodes[0].nodeValue =
<!--How do I fit getText(content) into here?-->
}
return false;
} else {
return true;
}
}
//Buttons
<a onclick="return showPic(this, jan);return false;"
href="../images/bananas.jpg" title="January - Garnet">January</a>
<a onclick="return showPic(this, feb);return false;"
href="../images/condiments.jpg" title="February - Amethyst">February</a>
//ID “cont”
<td valign="top" id="cont">hello</td>
Right now, what I am trying to make happen is whenever a link is pressed, I want function getText(a) to write new text
into the id element “cont” via showPic(), how do I do that?
I’m stumped...
//variables
var jan = "The traditional birthstone for January is Garnet”;
var feb = "The traditional birthstone for February is Amethyst”;
//Javascript
function getText (a) {
document.write(a)
}
function showPic (whichpic, content) {
if (document.getElementById) {
document.getElementById('placeholder').src = whichpic.href;
if (whichpic.title) {
document.getElementById('cont').childNodes[0].nodeValue =
<!--How do I fit getText(content) into here?-->
}
return false;
} else {
return true;
}
}
//Buttons
<a onclick="return showPic(this, jan);return false;"
href="../images/bananas.jpg" title="January - Garnet">January</a>
<a onclick="return showPic(this, feb);return false;"
href="../images/condiments.jpg" title="February - Amethyst">February</a>
//ID “cont”
<td valign="top" id="cont">hello</td>