-2

I am getting the error as defined below for a piece of code in html written in a JavaScript file -> This is the error

D:\OnlineBookStore\RouteHandler.js:23
                 var  html= "<body bgcolor='#E2C2F6'>
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: Invalid or unexpected token
←[90m    at wrapSafe (internal/modules/cjs/loader.js:1001:16)←[39m
←[90m    at Module._compile (internal/modules/cjs/loader.js:1049:27)←[39m
←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)←[39m
←[90m    at Module.load (internal/modules/cjs/loader.js:950:32)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:790:12)←[39m
←[90m    at Module.require (internal/modules/cjs/loader.js:974:19)←[39m
←[90m    at require (internal/modules/cjs/helpers.js:93:18)←[39m
    at Object.<anonymous> (D:\OnlineBookStore\BookRouting.js:1:20)
←[90m    at Module._compile (internal/modules/cjs/loader.js:1085:14)←[39m
←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)←[39m

For the var html part in the below file it is giving error -> This is the part of code

exports.display_signup=function(url, request, response){
         response.writeHead(200, {'Content-Type': 'text/html'});
         var  html= "<body bgcolor='#E2C2F6'>  
              <center>
                   <H1>Book Cart</H1>
                   <h4>SignUp</h4>
                   <form name='myform' action='http://localhost:3000/register' method='post'>
                    <table>
                         <tr>
                             <td>UserName:</td>
                             <td><input type='text' name='username' value=' ' /></td>                                      
                         </tr>
                         <tr>
                             <td>Password:</td>
                             <td><input type='password' name='password' value=' ' />                                       </td>
                         </tr>
                         <tr>
                              <td>Confirm Password:</td>
                              <td><input type='password' name='confirmpassword' value=' ' /></td>
                         </tr>
                         <tr>
                              <td>Address:</td>
                              <td><input type='text' name='address' value=' ' /></td>
                         </tr>
                         <tr>
                            <td></td>
           <td><input type='submit'  value='Register' /></td>
                             </tr>
                        </table>
                   </form>
              </center>
         </body>";

response.write(html);

  • 1
    Include all errors and relevant code in the body of your question ***as text***, not as images - it takes fewer clicks to copy/paste your code than it does to screenshot and upload your code. It also allows potential answerers to better assist you because we won't have to re-type every single line of code to reproduce your issue. [Why not upload images of code/errors when asking a question?](https://meta.stackoverflow.com/questions/285551/why-not-upload-images-of-code-errors-when-asking-a-question) – esqew Oct 26 '21 at 19:56
  • that is not a tag it is just defining the background color of the body tag – Akhilesh Raturi Oct 26 '21 at 19:56
  • 1
    Looks like you have a line break in your string. That's not allowed. – Barmar Oct 26 '21 at 19:57
  • Duplicate of https://stackoverflow.com/questions/805107/creating-multiline-strings-in-javascript – esqew Oct 26 '21 at 19:57

1 Answers1

0

So the query is resolved i used `` symbol instead of "". this resolved my issue.