...

View Full Version : unterminated string literal



soesan01
09-22-2010, 08:23 AM
Guys, I need help. I have a javascript (bellow). When I execute this, I got an error "unterminated string literal".

Any help?



<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>

Spudhead
09-22-2010, 11:26 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum