Monday 15 June 2015

javascript - This works in IE but not chrome. How do I get it to work in all browsers? -


It works great in IE, but I checked it in Chrome and it does not work. First of all I am creating a text field with HTML tags and color drop down selection. It should be written in the text field, "This is a P tag" and in the color you choose from the drop down selection. I just know Javascript, yet have not started learning jQuery.

  function createTextArea () {var textAreaElement = document.createElement ("textarea"); TextAreaElement.id = "textarea"; TextAreaElement.rows = "13"; TextAreaElement.cols = "25"; Document.body.appendChild (textAreaElement); } Function textArea () {var textarea = document.getElementById ("textarea"); Var mylist = document.getElementById ("myList"); Var option = mylist.options [mylist.selectedIndex] .text; Var color = textcolor.options [textcolor.selectedIndex] .text; Var element = document.createElement (option); Var mytext; Var Textor; Switch (option) {case "p": mytext = "I'm a paragraph tag."; break; Case "div": mytext = "I'm a div tag."; break; Case "span": mytext = "I'm a span tag."; break; The case "strong": mytext = "I am a strong tag."; break; Case "H1": mytext = "I'm an H1 tag."; break; The case "em": mytext = "I'm an M tag."; break; } Switch (color) {case "Red": textColor = "red"; break; Case "Blue": Text color = "blue"; break; Case "pink": text color = "pink"; break; Case "green": text color = "green"; break; Case "Crimson": Text color = "Crimson"; break; Case "yellow": text color = "yellow"; break; Case "dark slate blue": text collar = "darkslove"; break; Case "Dark Orange": Text Class = "Dark Orange"; break; Case "Dark Violet": Text Color = "DarkViolet"; break; Case "Deep Pink": Text color = "Deeppunk"; break; Case "Fuciana": Text Color = "Fuciana"; break; Case "Lime": text color = "lime"; break; "Kill" case: text color = "kill"; break; Case "Saddle brown": text color = "saddle brown"; break; Case "mound": text color = "mound"; break; } Var text = document.createTextNode (mytext); Element.style.color = textColor; Element.appendChild (text); Textarea.appendChild (element); } Function textAreaElements () {var selectElement = document.createElement ("select"); SelectElement.id = "myList"; SelectElement.onchange = textArea; {Var option = document.createElement ("option") for (I = 0; i <7; i ++); Various elements; Switch (i) {case 0: element = ""; break; Case 1: element = "p"; break; Case 2: element = "div"; break; Case 3: element = "duration"; break; Case 4: Element = "Strong"; break; Case 5: Element = "H1"; break; Case 6: element = "em"; break; } Var text = document.createTextNode (element); Document.body.appendChild (selectElement); SelectElement.appendChild (option); Options.appendChild (text); }} Function textAreaColor () {var selectElement = document.createElement ("select"); SelectElement.id = "textcolor"; SelectElement.onchange = textArea; {Var option = document.createElement ("option") for (i = 0; i    

I think that you want this change, I do not believe that children Permission is to be within

Changable data can be replaceable characters data in titles and texture elements in documents, HTML syntax. Substituted character data may contain the following:

The text, alternatively, "& lt;" In the Character References, there are the following restrictions in the changing character data:

In any ambiguous ampersands, there should not be any version of the string included, or "/.. < Pre> textarea.cs = / Html>

No comments:

Post a Comment