I know little of javascript so any help would be grateful
I am trying to 1)change background colors and 2)chang font colors,
I have 2 seperate js files that work independtly but when I use both they conflict.
can I either isolate one when trying to use the other
File 1 is
function executeonload(functionref){
if (window.addEventListener)
window.addEventListener("load", functionref, false)
else if (window.attachEvent)
window.attachEvent("onload", functionref)
else if (document.getElementById)
window.onload=functionref
}
var ddcolorposter={
initialize:function(r,g,b, hexvalue){
this.rvalue=r //store red value
this.gvalue=g //store green value
this.bvalue=b //store blue value
this.hexvalue=hexvalue //store combined hex value
if (typeof this.targetobj!="undefined"){
this.targetobj.value=this.hexvalue //set field to selected hex color value
if (typeof this.divobj!="undefined"){ //set adjacent div to selected hex color value
this.divobj.style.backgroundColor="#"+this.hexvalue
this.divobj2.style.backgroundColor="#"+this.hexvalue
}
}
},
echocolor:function(inputobj, divID, divID2){
this.targetobj=inputobj
this.divobj=document.getElementById(divID)
this.divobj2=document.getElementById(divID2)
this.targetobj.onblur=function(){
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1){ //if field contains valid hex value
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
document.getElementById(divID2).style.backgroundColor="#"+inputobj.value
}
}
},
fillcolorbox:function(inputID, divID, divID2){
var inputobj=document.getElementById(inputID)
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1){ //if field contains valid hex value
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
document.getElementById(divID2).style.backgroundColor="#"+inputobj.value
}
}
}
and file 2 is the same but with backgroundColor changed to color
I have tried changing identities for hours but get nowhere.
I was hoping I may be able to use a start Java2 and end java 2 around the item I want to change, or am I talking rubbish
Steve
I am trying to 1)change background colors and 2)chang font colors,
I have 2 seperate js files that work independtly but when I use both they conflict.
can I either isolate one when trying to use the other
File 1 is
function executeonload(functionref){
if (window.addEventListener)
window.addEventListener("load", functionref, false)
else if (window.attachEvent)
window.attachEvent("onload", functionref)
else if (document.getElementById)
window.onload=functionref
}
var ddcolorposter={
initialize:function(r,g,b, hexvalue){
this.rvalue=r //store red value
this.gvalue=g //store green value
this.bvalue=b //store blue value
this.hexvalue=hexvalue //store combined hex value
if (typeof this.targetobj!="undefined"){
this.targetobj.value=this.hexvalue //set field to selected hex color value
if (typeof this.divobj!="undefined"){ //set adjacent div to selected hex color value
this.divobj.style.backgroundColor="#"+this.hexvalue
this.divobj2.style.backgroundColor="#"+this.hexvalue
}
}
},
echocolor:function(inputobj, divID, divID2){
this.targetobj=inputobj
this.divobj=document.getElementById(divID)
this.divobj2=document.getElementById(divID2)
this.targetobj.onblur=function(){
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1){ //if field contains valid hex value
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
document.getElementById(divID2).style.backgroundColor="#"+inputobj.value
}
}
},
fillcolorbox:function(inputID, divID, divID2){
var inputobj=document.getElementById(inputID)
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1){ //if field contains valid hex value
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
document.getElementById(divID2).style.backgroundColor="#"+inputobj.value
}
}
}
and file 2 is the same but with backgroundColor changed to color
I have tried changing identities for hours but get nowhere.
I was hoping I may be able to use a start Java2 and end java 2 around the item I want to change, or am I talking rubbish
Steve