Forum Moderators: open
document.all[str1].style[str2] = str3;
str1 = the id name
str2 = the type that has to be changed (color, width, etc)
str3 = the value from the input field
but then the names are not the same [str2] as they are in the STYLE sheet:
width stays width
background-color becomes background [i tried background-color there but it didn't worked]
what about:
border-bottom-width
border-bottom-style
border-bottom-color
font-family
font-size
....?
is there a possibility where I can used exactly the same name as stated in the STYLE sheet?
<head>
<style>
td.polltitle
{
text-align: center;
background-color: #009999;
...
}
</style>
</head>
<body>
<table>
<tr><td class="polltitle"></td></tr>
...
</table>
<input type="text" onchange="change()" id="ep1">
....
JavaScript gets confused with a hyphen ("-") and things you mean, for example,
font-weight
font(minus)weight
But luckily most hyphenated CSS attributes can be accessed using no hyphen and capitalising the first letter of the second word, like so,
fontWeight
:)
Jordan