Kcirtap
03-10-2005, 02:16 PM
Hello,
I might be missing somthing here, but there really is something I cannot figure out.
After some reading and thinking, I have managed to work out how to modify the properties of an object. Let's say I have a DIV somewhere in a BODY. I can use :
var d = document.getElementbyId("div_name")
then I am free to modify properties for div_name :
d.style.background-color = #00ffff ;
that work fine
But I cannot seem to wor out how to apply a method to an object. this is what I am thinking of. I have a DIV in the middle of a BODY.
If I write :
document.write("blablabla") ; it will put blablabla wherever my script is being called from in the document flow.
What I want is write to my DIV :
var d = document.getElementbyId("div_name") ;
and then
d.write("blablabla") ; in order to write directly to the appropriate DIV.
Should that work or is there something close, or am i totally out of the blue?
:confused:
The question behind all this is, I have methods that apply to objects like document for example. Can I not create an object of type document that can take document's methods? What should I do and read to get a better grasp on this?
kcirtap Langiv
I might be missing somthing here, but there really is something I cannot figure out.
After some reading and thinking, I have managed to work out how to modify the properties of an object. Let's say I have a DIV somewhere in a BODY. I can use :
var d = document.getElementbyId("div_name")
then I am free to modify properties for div_name :
d.style.background-color = #00ffff ;
that work fine
But I cannot seem to wor out how to apply a method to an object. this is what I am thinking of. I have a DIV in the middle of a BODY.
If I write :
document.write("blablabla") ; it will put blablabla wherever my script is being called from in the document flow.
What I want is write to my DIV :
var d = document.getElementbyId("div_name") ;
and then
d.write("blablabla") ; in order to write directly to the appropriate DIV.
Should that work or is there something close, or am i totally out of the blue?
:confused:
The question behind all this is, I have methods that apply to objects like document for example. Can I not create an object of type document that can take document's methods? What should I do and read to get a better grasp on this?
kcirtap Langiv