The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> JS Problems, again.
locoforcoco9
post Apr 30 2012, 07:18 PM
Post #1





Group: Members
Posts: 6
Joined: 18-January 11
Member No.: 13,624



My website for my class uses a little TextArea (with id="coder") that has a button that SHOULD send the info to a function, which will read that. It reads it and does 99.9% of what it should, but on FireFox it breaks completely at this point:
CODE

            for (i=1;1<len;i++) {
                if (lines[i].indexOf(":") !== -1) {styles = lines[i].split(":"); }
                if (lines[i].indexOf(": ") !== -1) {styles = lines[i].split(": "); }
                document.getElementById("coder").style[styles[0]] = styles[1]; //---THIS
            }


It breaks at the 4th line shown. It says that document.getElementById("coder") is null, even though to get to that point it uses that exact text to check what the first line is.

NOTE:
This is supposed to allow the user to change the style of it by typing in "#style" (w/o quotes) on the first line, and the next line(s) should contain a format of PROPERTY: DESCRIPTORS. Example:
CODE

#style
border: 2px solid red
position: absolute
top: 100
left: 100


Would act as if it had a CSS style doing the same things.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
locoforcoco9
post Apr 30 2012, 07:33 PM
Post #2





Group: Members
Posts: 6
Joined: 18-January 11
Member No.: 13,624



Oi, nevermind. I realized the problem; it isn't with the shown code. Sorry.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 16th April 2024 - 01:44 PM