Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    unterminated string literal

    Guys, I need help. I have a javascript (bellow). When I execute this, I got an error "unterminated string literal".

    Any help?

    Code:
    <script type="text/javascript">
      //<![CDATA[
      try {
      add_1_more = function(element) {
    	Element.insert("add-more-link", { before: "\n<div class=\"form question-main\">\n    <input id=\"question_spelling_questions__type\" name=\"question[spelling_questions][][type]\" type=\"hidden\" value=\"SpellingQuestion\" />\n<input id=\"question_set_id\" name=\"question_set_id\" type=\"hidden\" value=\"348\" />\n\n<div><label for=\"question[spelling_questions][]_spelling word\">Spelling Word</label> <input class=\"tx text_field\" id=\"question_text_\" name=\"question[spelling_questions][][text]\" size=\"30\" type=\"text\" /> </div>\n\n<script type=\"text/javascript\">\n//<![CDATA[\ntry {\nsetupHelpTextHandling(\"question_text_\", \"Enter the word here...\");\n} catch (e) { alert('RJS error:\\n\\n' + e.toString()); alert('setupHelpTextHandling(\\\"question_text_\\\", \\\"Enter the word here...\\\");'); throw e }\n//]]>\n</script>\n\n<div><label for=\"question[spelling_questions][]_sentence\">Sentence</label> <input class=\"tx-long text_field\" id=\"question_sentence_\" name=\"question[spelling_questions][][sentence]\" size=\"30\" type=\"text\" /> </div>\n\n\n<div><label for=\"question[spelling_questions][]_case sensitive\">Case sensitive</label> <input name=\"question[spelling_questions][][case_sensitive]\" type=\"hidden\" value=\"0\" /><input class=\"check_box\" id=\"question_spelling_questions__case_sensitive\" name=\"question[spelling_questions][][case_sensitive]\" type=\"checkbox\" value=\"1\" /> </div>\n\n<div style=\"color: red; line-height: 1.2em; margin-top: 2em;\"></div>\n\n<div style=\"margin-top: 1em;\">\n  \n</div>\n\n  <div><label for=\"question[new_question_images][]_add a picture from your computer &lt;em&gt;(optional)&lt;/em&gt;\">Add a picture from your computer <em>(optional)</em></label> <input class=\"file file_field\" id=\"question_new_question_images__uploaded_data\" name=\"question[new_question_images][][uploaded_data]\" size=\"30\" type=\"file\" /> </div>\n\n\n\n</div>\n\n<div style=\"clear: both; border-bottom: 1px solid gray; padding-bottom: 2em;\"> </div>\n\n<p></p>\n\n" });
    			}
    			} catch (e) { alert('RJS error:\n\n' + e.toString()); alert('add_5_more = function(element) {\nElement.insert(\"add-more-link\", { before: \"\\n<div class=\\\"form question-main\\\">\\n    <input id=\\\"question_spelling_questions__type\\\" name=\\\"question[spelling_questions][][type]\\\" type=\\\"hidden\\\" value=\\\"SpellingQuestion\\\" />\\n<input id=\\\"question_set_id\\\" name=\\\"question_set_id\\\" type=\\\"hidden\\\" value=\\\"348\\\" />\\n\\n<div><label for=\\\"question[spelling_questions][]_spelling word\\\">Spelling Word</label> <input class=\\\"tx text_field\\\" id=\\\"question_text_\\\" name=\\\"question[spelling_questions][][text]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n<script type=\\\"text/javascript\\\">\\n//<![CDATA[\\ntry {\\nsetupHelpTextHandling(\\\"question_text_\\\", \\\"Enter the word here...\\\");\\n} catch (e) { alert(\'RJS error:\\\\n\\\\n\' + e.toString()); alert(\'setupHelpTextHandling(\\\\\\\"question_text_\\\\\\\", \\\\\\\"Enter the word here...\\\\\\\");\'); throw e }\\n//]]>\\n</script>\\n\\n<div><label for=\\\"question[spelling_questions][]_sentence\\\">Sentence</label> <input class=\\\"tx-long text_field\\\" id=\\\"question_sentence_\\\" name=\\\"question[spelling_questions][][sentence]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n\\n<div><label for=\\\"question[spelling_questions][]_case sensitive\\\">Case sensitive</label> <input name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"hidden\\\" value=\\\"0\\\" /><input class=\\\"check_box\\\" id=\\\"question_spelling_questions__case_sensitive\\\" name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"checkbox\\\" value=\\\"1\\\" /> </div>\\n\\n<div style=\\\"color: red; line-height: 1.2em; margin-top: 2em;\\\"></div>\\n\\n<div style=\\\"margin-top: 1em;\\\">\\n  \\n</div>\\n\\n  <div><label for=\\\"question[new_question_images][]_add a picture from your computer &lt;em&gt;(optional)&lt;/em&gt;\\\">Add a picture from your computer <em>(optional)</em></label> <input class=\\\"file file_field\\\" id=\\\"question_new_question_images__uploaded_data\\\" name=\\\"question[new_question_images][][uploaded_data]\\\" size=\\\"30\\\" type=\\\"file\\\" /> </div>\\n\\n\\n\\n</div>\\n\\n<div style=\\\"clear: both; border-bottom: 1px solid gray; padding-bottom: 2em;\\\"> </div>\\n\\n<p></p>\\n\\n\" });\nElement.insert(\"add-more-link\", { before: \"\\n<div class=\\\"form question-main\\\">\\n    <input id=\\\"question_spelling_questions__type\\\" name=\\\"question[spelling_questions][][type]\\\" type=\\\"hidden\\\" value=\\\"SpellingQuestion\\\" />\\n<input id=\\\"question_set_id\\\" name=\\\"question_set_id\\\" type=\\\"hidden\\\" value=\\\"348\\\" />\\n\\n<div><label for=\\\"question[spelling_questions][]_spelling word\\\">Spelling Word</label> <input class=\\\"tx text_field\\\" id=\\\"question_text_\\\" name=\\\"question[spelling_questions][][text]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n<script type=\\\"text/javascript\\\">\\n//<![CDATA[\\ntry {\\nsetupHelpTextHandling(\\\"question_text_\\\", \\\"Enter the word here...\\\");\\n} catch (e) { alert(\'RJS error:\\\\n\\\\n\' + e.toString()); alert(\'setupHelpTextHandling(\\\\\\\"question_text_\\\\\\\", \\\\\\\"Enter the word here...\\\\\\\");\'); throw e }\\n//]]>\\n</script>\\n\\n<div><label for=\\\"question[spelling_questions][]_sentence\\\">Sentence</label> <input class=\\\"tx-long text_field\\\" id=\\\"question_sentence_\\\" name=\\\"question[spelling_questions][][sentence]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n\\n<div><label for=\\\"question[spelling_questions][]_case sensitive\\\">Case sensitive</label> <input name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"hidden\\\" value=\\\"0\\\" /><input class=\\\"check_box\\\" id=\\\"question_spelling_questions__case_sensitive\\\" name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"checkbox\\\" value=\\\"1\\\" /> </div>\\n\\n<div style=\\\"color: red; line-height: 1.2em; margin-top: 2em;\\\"></div>\\n\\n<div style=\\\"margin-top: 1em;\\\">\\n  \\n</div>\\n\\n  <div><label for=\\\"question[new_question_images][]_add a picture from your computer &lt;em&gt;(optional)&lt;/em&gt;\\\">Add a picture from your computer <em>(optional)</em></label> <input class=\\\"file file_field\\\" id=\\\"question_new_question_images__uploaded_data\\\" name=\\\"question[new_question_images][][uploaded_data]\\\" size=\\\"30\\\" type=\\\"file\\\" /> </div>\\n\\n\\n\\n</div>\\n\\n<div style=\\\"clear: both; border-bottom: 1px solid gray; padding-bottom: 2em;\\\"> </div>\\n\\n<p></p>\\n\\n\" });\nElement.insert(\"add-more-link\", { before: \"\\n<div class=\\\"form question-main\\\">\\n    <input id=\\\"question_spelling_questions__type\\\" name=\\\"question[spelling_questions][][type]\\\" type=\\\"hidden\\\" value=\\\"SpellingQuestion\\\" />\\n<input id=\\\"question_set_id\\\" name=\\\"question_set_id\\\" type=\\\"hidden\\\" value=\\\"348\\\" />\\n\\n<div><label for=\\\"question[spelling_questions][]_spelling word\\\">Spelling Word</label> <input class=\\\"tx text_field\\\" id=\\\"question_text_\\\" name=\\\"question[spelling_questions][][text]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n<script type=\\\"text/javascript\\\">\\n//<![CDATA[\\ntry {\\nsetupHelpTextHandling(\\\"question_text_\\\", \\\"Enter the word here...\\\");\\n} catch (e) { alert(\'RJS error:\\\\n\\\\n\' + e.toString()); alert(\'setupHelpTextHandling(\\\\\\\"question_text_\\\\\\\", \\\\\\\"Enter the word here...\\\\\\\");\'); throw e }\\n//]]>\\n</script>\\n\\n<div><label for=\\\"question[spelling_questions][]_sentence\\\">Sentence</label> <input class=\\\"tx-long text_field\\\" id=\\\"question_sentence_\\\" name=\\\"question[spelling_questions][][sentence]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n\\n<div><label for=\\\"question[spelling_questions][]_case sensitive\\\">Case sensitive</label> <input name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"hidden\\\" value=\\\"0\\\" /><input class=\\\"check_box\\\" id=\\\"question_spelling_questions__case_sensitive\\\" name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"checkbox\\\" value=\\\"1\\\" /> </div>\\n\\n<div style=\\\"color: red; line-height: 1.2em; margin-top: 2em;\\\"></div>\\n\\n<div style=\\\"margin-top: 1em;\\\">\\n  \\n</div>\\n\\n  <div><label for=\\\"question[new_question_images][]_add a picture from your computer &lt;em&gt;(optional)&lt;/em&gt;\\\">Add a picture from your computer <em>(optional)</em></label> <input class=\\\"file file_field\\\" id=\\\"question_new_question_images__uploaded_data\\\" name=\\\"question[new_question_images][][uploaded_data]\\\" size=\\\"30\\\" type=\\\"file\\\" /> </div>\\n\\n\\n\\n</div>\\n\\n<div style=\\\"clear: both; border-bottom: 1px solid gray; padding-bottom: 2em;\\\"> </div>\\n\\n<p></p>\\n\\n\" });\nElement.insert(\"add-more-link\", { before: \"\\n<div class=\\\"form question-main\\\">\\n    <input id=\\\"question_spelling_questions__type\\\" name=\\\"question[spelling_questions][][type]\\\" type=\\\"hidden\\\" value=\\\"SpellingQuestion\\\" />\\n<input id=\\\"question_set_id\\\" name=\\\"question_set_id\\\" type=\\\"hidden\\\" value=\\\"348\\\" />\\n\\n<div><label for=\\\"question[spelling_questions][]_spelling word\\\">Spelling Word</label> <input class=\\\"tx text_field\\\" id=\\\"question_text_\\\" name=\\\"question[spelling_questions][][text]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n<script type=\\\"text/javascript\\\">\\n//<![CDATA[\\ntry {\\nsetupHelpTextHandling(\\\"question_text_\\\", \\\"Enter the word here...\\\");\\n} catch (e) { alert(\'RJS error:\\\\n\\\\n\' + e.toString()); alert(\'setupHelpTextHandling(\\\\\\\"question_text_\\\\\\\", \\\\\\\"Enter the word here...\\\\\\\");\'); throw e }\\n//]]>\\n</script>\\n\\n<div><label for=\\\"question[spelling_questions][]_sentence\\\">Sentence</label> <input class=\\\"tx-long text_field\\\" id=\\\"question_sentence_\\\" name=\\\"question[spelling_questions][][sentence]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n\\n<div><label for=\\\"question[spelling_questions][]_case sensitive\\\">Case sensitive</label> <input name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"hidden\\\" value=\\\"0\\\" /><input class=\\\"check_box\\\" id=\\\"question_spelling_questions__case_sensitive\\\" name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"checkbox\\\" value=\\\"1\\\" /> </div>\\n\\n<div style=\\\"color: red; line-height: 1.2em; margin-top: 2em;\\\"></div>\\n\\n<div style=\\\"margin-top: 1em;\\\">\\n  \\n</div>\\n\\n  <div><label for=\\\"question[new_question_images][]_add a picture from your computer &lt;em&gt;(optional)&lt;/em&gt;\\\">Add a picture from your computer <em>(optional)</em></label> <input class=\\\"file file_field\\\" id=\\\"question_new_question_images__uploaded_data\\\" name=\\\"question[new_question_images][][uploaded_data]\\\" size=\\\"30\\\" type=\\\"file\\\" /> </div>\\n\\n\\n\\n</div>\\n\\n<div style=\\\"clear: both; border-bottom: 1px solid gray; padding-bottom: 2em;\\\"> </div>\\n\\n<p></p>\\n\\n\" });\nElement.insert(\"add-more-link\", { before: \"\\n<div class=\\\"form question-main\\\">\\n    <input id=\\\"question_spelling_questions__type\\\" name=\\\"question[spelling_questions][][type]\\\" type=\\\"hidden\\\" value=\\\"SpellingQuestion\\\" />\\n<input id=\\\"question_set_id\\\" name=\\\"question_set_id\\\" type=\\\"hidden\\\" value=\\\"348\\\" />\\n\\n<div><label for=\\\"question[spelling_questions][]_spelling word\\\">Spelling Word</label> <input class=\\\"tx text_field\\\" id=\\\"question_text_\\\" name=\\\"question[spelling_questions][][text]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n<script type=\\\"text/javascript\\\">\\n//<![CDATA[\\ntry {\\nsetupHelpTextHandling(\\\"question_text_\\\", \\\"Enter the word here...\\\");\\n} catch (e) { alert(\'RJS error:\\\\n\\\\n\' + e.toString()); alert(\'setupHelpTextHandling(\\\\\\\"question_text_\\\\\\\", \\\\\\\"Enter the word here...\\\\\\\");\'); throw e }\\n//]]>\\n</script>\\n\\n<div><label for=\\\"question[spelling_questions][]_sentence\\\">Sentence</label> <input class=\\\"tx-long text_field\\\" id=\\\"question_sentence_\\\" name=\\\"question[spelling_questions][][sentence]\\\" size=\\\"30\\\" type=\\\"text\\\" /> </div>\\n\\n\\n<div><label for=\\\"question[spelling_questions][]_case sensitive\\\">Case sensitive</label> <input name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"hidden\\\" value=\\\"0\\\" /><input class=\\\"check_box\\\" id=\\\"question_spelling_questions__case_sensitive\\\" name=\\\"question[spelling_questions][][case_sensitive]\\\" type=\\\"checkbox\\\" value=\\\"1\\\" /> </div>\\n\\n<div style=\\\"color: red; line-height: 1.2em; margin-top: 2em;\\\"></div>\\n\\n<div style=\\\"margin-top: 1em;\\\">\\n  \\n</div>\\n\\n  <div><label for=\\\"question[new_question_images][]_add a picture from your computer &lt;em&gt;(optional)&lt;/em&gt;\\\">Add a picture from your computer <em>(optional)</em></label> <input class=\\\"file file_field\\\" id=\\\"question_new_question_images__uploaded_data\\\" name=\\\"question[new_question_images][][uploaded_data]\\\" size=\\\"30\\\" type=\\\"file\\\" /> </div>\\n\\n\\n\\n</div>\\n\\n<div style=\\\"clear: both; border-bottom: 1px solid gray; padding-bottom: 2em;\\\"> </div>\\n\\n<p></p>\\n\\n\" });\n}'); throw e }
    			//]]>
    	<\/script>
    Last edited by soesan01; 09-22-2010 at 08:28 AM. Reason: make it nice

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    I can offer no useful advice to you other than you should track down the cretinous wretch who wrote that garbled mess of hopelessly unmaintainable code, and take steps to ensure that they are never again allowed unsupervised access to a code editor. Their crimes against programming should not go unpunished.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •