Hi everyone,
I am trying to update the value which is stored in a particular part of my page by using the getElementsById method, followed by calling a function to update the field. However, I don’t know how to do this. The relevant parts of my code are as follows:
[CODE=javascript]
function text(t)
{
return document.create TextNode(t);
}
function start(){
var oHelloText = text(getQuestio n()); //the getQuestion method returns a string from an array
oHelloText.id = "test";
}
function updateDetails()
{
document.getEle mentById('test' ) = text(getQuestio n());
}
[/CODE]
//sometime later, call to updateDetails method.
Unsurprisingly, this doesn’t work.
Any advice?
I am trying to update the value which is stored in a particular part of my page by using the getElementsById method, followed by calling a function to update the field. However, I don’t know how to do this. The relevant parts of my code are as follows:
[CODE=javascript]
function text(t)
{
return document.create TextNode(t);
}
function start(){
var oHelloText = text(getQuestio n()); //the getQuestion method returns a string from an array
oHelloText.id = "test";
}
function updateDetails()
{
document.getEle mentById('test' ) = text(getQuestio n());
}
[/CODE]
//sometime later, call to updateDetails method.
Unsurprisingly, this doesn’t work.
Any advice?
Comment