is there a mapping from HTML property names to DOM propety names?

Burghardsnuk

New Member
in HTML\[code\]<td colspan=3 style='background-color:pink;' >hello world</td>\[/code\]but in Javascript / DOM\[code\]var td = document.createElement('td');td.colSpan = 3;td.style.backgroundColor = 'pink';\[/code\]is there a mapping of HTML properties and styles to Javascript/DOM attributes and styles?understand about camelBack for CSS stylehave some HTML specifications, eg, \[code\]colspan=3\[/code\], and implementing them with Javascript. so need a mapping between HTML property name and DOM property names.ok, here's a mapping for the abnormal properties. those with a 1::1 mapping and functions are omitted.html2dom = { acceptcharset: 'acceptCharset', accesskey: 'accessKey', bgcolor: 'bgColor', cellindex: 'cellIndex', cellpadding: 'cellPadding', cellspacing: 'cellSpacing', choff: 'chOff', class: 'className', codebase: 'codeBase', codetype: 'codeType', colspan: 'colSpan', datetime: 'dateTime', defaultchecked: 'defaultChecked', defaultselected: 'defaultSelected', defaultvalue: 'defaultValue', frameborder: 'frameBorder', htmlfor: 'htmlFor', httpequiv: 'httpEquiv', longdesc: 'longDesc', marginheight: 'marginHeight', marginwidth: 'marginWidth', maxlength: 'maxLength', nohref: 'noHref', noresize: 'noResize', noshade: 'noShade', nowrap: 'noWrap', readonly: 'readOnly', rowindex: 'rowIndex', rowspan: 'rowSpan', sectionrowindex: 'sectionRowIndex', selectedindex: 'selectedIndex', tabindex: 'tabIndex', tbodies: 'tBodies', tfoot: 'tFoot', thead: 'tHead', url: 'URL', usemap: 'useMap', valign: 'vAlign', valuetype: 'valueType' };
 
Back
Top