342 } |
342 } |
343 |
343 |
344 function setAttrib(elm, attrib, value) { |
344 function setAttrib(elm, attrib, value) { |
345 var formObj = document.forms[0]; |
345 var formObj = document.forms[0]; |
346 var valueElm = formObj.elements[attrib.toLowerCase()]; |
346 var valueElm = formObj.elements[attrib.toLowerCase()]; |
|
347 var dom = tinyMCEPopup.editor.dom; |
347 |
348 |
348 if (typeof(value) == "undefined" || value == null) { |
349 if (typeof(value) == "undefined" || value == null) { |
349 value = ""; |
350 value = ""; |
350 |
351 |
351 if (valueElm) |
352 if (valueElm) |
352 value = valueElm.value; |
353 value = valueElm.value; |
353 } |
354 } |
354 |
355 |
355 if (value != "") { |
356 // Clean up the style |
356 elm.setAttribute(attrib.toLowerCase(), value); |
357 if (attrib == 'style') |
357 |
358 value = dom.serializeStyle(dom.parseStyle(value)); |
358 if (attrib == "style") |
359 |
359 attrib = "style.cssText"; |
360 dom.setAttrib(elm, attrib, value); |
360 |
|
361 // if (attrib.substring(0, 2) == 'on') |
|
362 // value = 'return true;' + value; |
|
363 |
|
364 if (attrib == "class") |
|
365 attrib = "className"; |
|
366 |
|
367 elm[attrib] = value; |
|
368 } else |
|
369 elm.removeAttribute(attrib); |
|
370 } |
361 } |
371 |
362 |
372 function getAnchorListHTML(id, target) { |
363 function getAnchorListHTML(id, target) { |
373 var inst = tinyMCEPopup.editor; |
364 var inst = tinyMCEPopup.editor; |
374 var nodes = inst.dom.select('a.mceItemAnchor,img.mceItemAnchor'), name, i; |
365 var nodes = inst.dom.select('a.mceItemAnchor,img.mceItemAnchor'), name, i; |