Forum Moderators: open
<!-- Begin
function copyit(theField) {
var selectedText = document.selection;
if (selectedText.type == '<b style="color:black;background-color:#99ff99">Text</b>') {
var newRange = selectedText.createRange();
theField.focus();
theField.value = newRange.<b style="color:black;background-color:#99ff99">text</b>;
} else {
alert('select a <b style="color:black;background-color:#99ff99">text</b> in the page and then press this button');
}
}
// End -->
gives me an error:
missing name after . operator
line 7, char 83
theField.value = newRange.<b style="color:black;background-color:#99ff99">text</b>;
theField.value = newRange.<b style="color:black;background-color:#99ff99">text</b>; That's what it is complaining about. I usually don't work with ranges and selections because of the poor support for it, so I can't really tell you what you're supposed to do to get it working, but I do know that the whole newRange.<b style="color:black;background-color:#99ff99">text</b> thing is what's causing the error.