unkwntech Posted April 13, 2009 Share Posted April 13, 2009 I'm getting the following error on load: Uncaught SyntaxError: Unexpected token ILLEGAL file://path/to/file.ext (line 13) This is the code: function changeFormLength() { var rows = document.getElementById('rows').value; var i = 0; while(i < rows) { //the line under this is line 13, this line (comment) does not exist in the code document.getElementById('rowSpace').innerHTML += '<tr> <td><input type="text" name="firstname_'+i+'" id="firstname" /></td> <td><input type="text" name="lastname_'+i+'" id="lastname" /></td> <td><input name="cc_num_'+i+'" type="text" id="textfield3" size="20" maxlength="16" /></td> <td><label> <select name="cc_type_'+i+'" id="select"> <option value="visa" selected="selected">Visa</option> <option value="mastercard">MasterCard</option> <option value="discover">Discover</option> <option value="amex">American Express</option> </select> </label></td> <td><label> <select name="cc_exp_m_'+i+'" id="cc_exp_m"> <option value="01">1 January</option> <option value="02">2 Feburary</option> <option value="03">3 March</option> <option value="04">4 April</option> <option value="05">5 May</option> <option value="06">6 June</option> <option value="07">7 July</option> <option value="08">8 August</option> <option value="09">9 September</option> <option value="10">10 October</option> <option value="11">11 November</option> <option value="12">12 December</option> </select> / <select name="cc_exp_y_'+i+'" id="cc_exp_y"> <option value="2009">2009</option> <option value="2010">2010</option> <option value="2011">2011</option> <option value="2012">2012</option> <option value="2013">2013</option> <option value="2014">2014</option> <option value="2015">2015</option> <option value="2016">2016</option> <option value="2017">2017</option> <option value="2018">2018</option> <option value="2019">2019</option> <option value="2020">2020</option> </select> </label></td> <td><input name="cc_cvv_'+i+'" type="text" id="cc_cvv" size="5" maxlength="4" /></td> <td><input name="amt_'+i+'" type="text" id="amt" size="10" maxlength="7" /></td> </tr> '; i++; } } Link to comment https://forums.phpfreaks.com/topic/153817-solved-unexpected-token-illegal/ Share on other sites More sharing options...
unkwntech Posted April 13, 2009 Author Share Posted April 13, 2009 Apparently JS doesn't support multi-line string literals, so I had to add a \ to the end of each line Link to comment https://forums.phpfreaks.com/topic/153817-solved-unexpected-token-illegal/#findComment-808391 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.