Hi guys, I've got a problem editting my anchors using document.anchors, here's my code so far...
code:
function hideButtons(modus, myLink){
var tPos=0 //position in image array of toggle button
//for loop to find the position of the current toggle button
for(i=0; i<document.anchors.length; i++){
if(document.anchors[i].id==myLink.id){
tPos=i;
}
}
//statement to hide/show all buttons for editable region
if(modus.value='WYSIWYG'){//hide buttons
for(i=(tPos-10); i<tPos; i++){
alert(document.anchors[i]..visibility='hidden');
}
}
else{//Show buttons
for(i=(tPos-10); i<tPos; x++){
document.anchors[i].style.visibility='visible';
}
}
}
I've got a couple of text editors on my pages and they each have the same buttons, one of which changes the modus(HMTL/WYSIWYG) all butons are created as images with an anchor tag surrounding it, what I want to do is get the location of the anchor in the anchors array, subtract 10 to get a new position (there are always 10 buttons in a row) and change each of the ten items in the array to hidden/visible depending on the modus.
The errors I keep getting is that document.anchors[i].style is null or not an object.
Any clues here or alternative solution I could try using?
TIA
Blaise.