javascript - Assigning .value to CSS style -
im working on little project.
here's thing. want have textfields read , value's read out of need assigned css rule.
i.e.
document.getelementbyid("bd").value;
i want value being read assigned border-radius.
.style.border-radius:<value>px;
but how make link.
then if have 3 divs of them have seperate names how can fix assign div selected?
edit: complete html
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>opdracht 1</title> <link rel="stylesheet" type="text/css" href="css.css" /> <script language="javascript"> function borderdikte(){ document.getelementbyid("bd").value; document.getelementbyid("bs").value; document.getelementbyid("bk").value; } </script> </head> <body> <div id="div1"></div> <div id="div2"></div> <div id="div3"></div> <br /><br /><br /><br /><br /><br /><br /> <table width="750" border="1" cellspacing="3" style="float:left;"> <tr> <td width="318">border dikte (thin, medium, thick)</td> <td width="419"><textarea id="bd"></textarea></td> </tr> <tr> <td>border soort (dashed, dotted, solid or double)</td> <td><textarea id="bs"></textarea></td> </tr> <tr> <td>border kleur (bijvoorbeeld #000 of #fff</td> <td><textarea id="bk"></textarea></td> </tr> <tr> <td>welke div? ( 1, 2 of 3)</td> <td><textarea id="dn"></textarea></td> </tr> <tr> <td align="center"></td> <td> <button>go</button></td> </tr> <tr> <td align="center"></td> <td> <button>reset</button></td> </tr> <tr> <td align="center"></td> <td> <button>onzichtbaar</button></td> </tr> </table> </body> </html>
edit 2:
i have rexplain guess...
example
[] [] [] border = thick border color = #0f0 border style = solid div = 2 press go
the values being read , being proccessed css 2nd div (div 2) adjusted.
[] **[]** [] ^ red , solid border = [textfield empty] border color = [textfield empty] border style = [textfield empty] div? = [textfield empty]
like so:
html
<div id = "one"></div><div id = "two"></div><div id = "three"></div>
javascript
var bordrad = parseint(document.getelementbyid("bd").value, 10); document.getelementbyid("one").style.borderradius = bordrad + "px";
i may have misunderstood question though, please clarify, and/or add of code.
Comments
Post a Comment