slitz Posted February 28, 2007 Report Posted February 28, 2007 Esmu pilnigs JS iesacejs, tapec prasu nelielu palidzibu, diezgan ilgi mekleju neta ka var mainit style <div> tagam. Bet neatradu. Meginaju pats uztaisit pec saviem ieskatiem, bet tomer skripts nestrada, varbyt kads zinosaks var palidzet?? <html> <head> <script type="text/javascript"> function Mainitdatus() { document.getElementById('MainDiv').style="width:100px; hight:100px; border: 2px solid #DDDDDD;" } </script> </head> <body> <div id="MainDiv" onclick="Mainitdatus()" style="width:100px; hight:100px; border: 2px solid #000000;"> lol lol </div> </body> </html> Un sekojosais errors... setting a property that has only a getter Mainitdatus()test.htm (line 6) onclick(click clientX=0, clientY=0)test.htm (line 1) [Break on this error] document.getElementById('MainDiv').style="width:100px; hight:100px; border: 2px ...
v3rb0 Posted February 28, 2007 Report Posted February 28, 2007 <style type="text/css"> .jaunais{width:100px; hight:100px; border: 2px solid #DDDDDD;}</style> un document.getElementById('MainDiv').className="jaunais";
rpr Posted February 28, 2007 Report Posted February 28, 2007 katru stilu atsevishkji vajag setot. bet bija tur kautkaads zemuudens akmens. ne visu vareeja caur js iesetot. document.getElementById('MainDiv').style['width']='100px';
andrisp Posted February 28, 2007 Report Posted February 28, 2007 elements.style.propertijs = 'vērtiba'; Var norādīt, man šķiet, jebkuru propertiju. Nu vismaz praktiski jebkuru. Nolasīt gan var tikai tās vērtības, kas ir iestatītas ar JS vai arī kā inline css.
Didulis Posted February 28, 2007 Report Posted February 28, 2007 Kā reiz ņemos ar līdzīgām darbībām un varu pāris piemērus te iebarot. Pirmkārt jau height nevis hight. 1. Tas ko v3rb0 minēja par class mainīšanu. Ērts risinājums 2. var el = getElementById('tavsID'); el.style.width = '100px'; el.style.border = '1px dotted rgb(170, 170, 0)'; 3. var el = getElementById('tavsID'); el.setAttribute('width', '100px');
andrisp Posted February 28, 2007 Report Posted February 28, 2007 3. variants der tikai bildēm, tabulām un to šūnām.
Recommended Posts