Jump to content

Document.get


Twango

Recommended Posts

yo. I've been making a Marquee (lol) generator.i've got it so it updates the scripts. Yet doesn't update the preview. Can you help?

<!--Scrollbar AKA Marquee Generator--><script type="text/javascript">function dirRep(tpart,choice){var choiceup=choice;var choiced=choice;choiced=choice.replace("<","<");choiced=choiced.replace(">",">");choiced=choiced.replace("/","/");choiced=choiced.replace("</","</");document.getElementById(tpart).innerHTML=choiced;if (tpart==value){}else{}if (tpart==bordercolor){document.getElementById('preview').border="solid 2px " + choiceup;}else{docoument.getElementById('preview').tpart=choiceup;}}</script><b>Direction:</b><select onchange="dirRep('direction',value)"><option value="left">Left</option><option value="right">Right</option><option value="up">Up</option><option value="down">Down</option></select><br/><b>Speed: </b><input type="text" id="spd"/><input type="button" value="OK" onclick="dirRep('scrollamount',document.getElementById('spd').value)"/><br/><b>Border color: </b><input type="text" id="bcl"/><input type="button" value="OK" onclick="dirRep('bordercolor',document.getElementById('bcl').value)"/><b style="color:red">•Put the word None for no border•</b><br/><b>Text color: </b><input type="text" id="tcl"/><input type="button" value="OK" onclick="dirRep('color',document.getElementById('tcl').value)"/><br/><b>Background Color: </b><input type="text" id="bcol"/><input type="button" value="OK" onclick="dirRep('backgroundColor',document.getElementById('bcol').value)"/><br/><b>Width: </b><input type="text" id="wdt" value="300"/><input type="button" value="OK" onclick="dirRep('width',document.getElementById('wdt').value)"/><br/><b>Height: </b><input type="text" id="hgt"/><input type="button" value="OK" onclick="dirRep('height',document.getElementById('hgt').value)"/><br/><b>Text for scroller: </b><input type="text" id="tex"/><input type="button" value="OK" onclick="dirRep('value',document.getElementById('tex').value)"/><br/><b style="color:red">You can now put HTML tags in the Text for scroller section</b><br/><!--Marquee Below--><p>Copy and paste this where you would put HTML or JavaScript <br/> Your scroller script:</p><!--Config--><b id="start"><marquee align="center" direction="</b><b id="direction">left</b><b id="other">" scrollamount="</b><b id="scrollamount">6</b><b id="other">" style="border:solid </b><b id="bordercolor">black</b> <b id="other">2px;color:</b><b id="color">black</b><b id="other">;background-color:</b><b id="backgroundColor">white</b><b id="other">" width="</b><b id="width">300</b><b id="other">px" height="</b><b id="height"></b><b id="other">px"></b><!--Value--><b id="value">Scroller Made With ScriptFreak.weebly.com</b><b id="fin"></marquee></b><br/><br/><marquee id="preview" align="center" direction="left" scrollamount="6" style="border:solid black 2px;color:black;background-color:white" width="300px" height="px"> Preview</marquee>

Link to comment
Share on other sites

Ok, so, i updated it but some of it still doesn't work. only the border color. how would i do the rest?<!--Scrollbar AKA Marquee Generator--><script type="text/javascript">function dirRep(tpart,choice,oth){var tp=tpart;var choiceup=choice;var choiced=choice;choiced=choice.replace("<","<");choiced=choiced.replace(">",">");choiced=choiced.replace("/","/");choiced=choiced.replace("</","</");document.getElementById(tpart).innerHTML=choiced;if (oth=="bordercolor"){document.getElementById('preview').style.borderColor=choiceup;}else{var b1=document.getElementById('preview').style;var b2=tp;var b3=choiceup;var tog=b1 + b2 + b3;tog}}</script><b>Direction:</b><select onchange="dirRep('direction',value)"><option value="left">Left</option><option value="right">Right</option><option value="up">Up</option><option value="down">Down</option></select><br/><b>Speed: </b><input type="text" id="spd"/><input type="button" value="OK" onclick="dirRep('scrollamount',document.getElementById('spd').value,'scrollamount')"/><br/><b>Border color: </b><input type="text" id="bcl"/><input type="button" value="OK" onclick="dirRep('bordercolor',document.getElementById('bcl').value,'bordercolor')"/><b style="color:red">•Put the word None for no border•</b><br/><b>Text color: </b><input type="text" id="tcl"/><input type="button" value="OK" onclick="dirRep('color',document.getElementById('tcl').value,'color')"/><br/><b>Background Color: </b><input type="text" id="bcol"/><input type="button" value="OK" onclick="dirRep('backgroundColor',document.getElementById('bcol').value,'backgroundColor')"/><br/><b>Width: </b><input type="text" id="wdt" value="300"/><input type="button" value="OK" onclick="dirRep('width',document.getElementById('wdt').value,'width')"/><br/><b>Height: </b><input type="text" id="hgt"/><input type="button" value="OK" onclick="dirRep('height',document.getElementById('hgt').value,'height')"/><br/><b>Text for scroller: </b><input type="text" id="tex"/><input type="button" value="OK" onclick="dirRep('value',document.getElementById('tex').value,'value')"/><br/><b style="color:red">You can now put HTML tags in the Text for scroller section</b><br/><!--Marquee Below--><p>Copy and paste this where you would put HTML or JavaScript <br/> Your scroller script:</p><!--Config--><b id="start"><marquee align="center" direction="</b><b id="direction">left</b><b id="other">" scrollamount="</b><b id="scrollamount">6</b><b id="other">" style="border:solid </b><b id="bordercolor">black</b> <b id="other">2px;color:</b><b id="color">black</b><b id="other">;background-color:</b><b id="backgroundColor">white</b><b id="other">" width="</b><b id="width">300</b><b id="other">px" height="</b><b id="height"></b><b id="other">px"></b><!--Value--><b id="value">Scroller Made With ScriptFreak.weebly.com</b><b id="fin"></marquee></b><br/><br/><marquee id="preview" align="center" direction="left" scrollamount="6" style="border:solid black 2px;color:black;background-color:white" width="300px" height="px"> Preview</marquee>

Link to comment
Share on other sites

It helps to know that the notation for the following get the same result:document.getElementById('preview').style.borderColoranddocument.getElementById('preview').style['borderColor']This means you can pass a string variable into the [brackets]which means that this will work:document.getElementById('preview').style[oth] = choiceup;You have a few other problems left, but you can probably work them out.And when you get around to it, think about the incredible redundancy that can be eliminated from this document.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...