How to change the style of a text area by editing one (couple of) file(s)

152 views Asked by At

I am trying to make a new style of a code box and often update the look, so i want it to have all the script external so if i edit on of the files it will update all the code boxes instead of having to edit them all

Here Is My Current Code:

<body>
<script>
var time = new Date().getHours();
if (time < 12) {
document.body.style.backgroundColor = 'lightblue';
} else if (time < 15) {
document.body.style.backgroundColor = 'blue'
} else if (time < 18) {
    document.body.style.backgroundColor = 'darkblue'
} else {
    document.body.style.backgroundColor = 'black'
}
</script>
<center>
<link rel="stylesheet" href="code-box-css.css">
<img src="http://sd-storage.weebly.com/files/theme/thecode.png" alt="The Code">
<br>
<textarea rows="12" name="styled-textarea" id="styled">
<font size=1 face=arial color=#1E83FF>Code From <a href="http://sd-storage.weebly.com/">SD- Storage</a></font>
<!--Do Not Remove Attribution Link-->

</textarea><br>
<font face=Arial color=#1E83FF size="1"><strong>Copyright © <script>
var today = new Date()
var year = today.getFullYear()
document.write(year)
</script> SD-Storage.weebly.com Inc. - All Rights Reserved.
</body>
1

There are 1 answers

0
UgaBeluga On BEST ANSWER

If I understand you right you need external CSS file. You have already created one (code-box-css.css) but it's not placed correctly. Move it inside <head></head> tags.

Now add class to all textareas you want to style, for example <textarea class="taStyle">.

As next, you have this external CSS (code-box-css.css), inside it add styles to that class like this:

.taStyle{background: green; color: red; font-size: 21px; }

I think that will solve your problem.