I have a really long line of code and i was wondering what the syntax is so that i could have it on multiple lines, for easier readibility.
Sorry, I have no idea what XSS is? I just want to break up the long lines of code so that they are more readible.
you can break into a new line whenever a space you have encountered. For example: if (a == b) { alert('Hello World'); } is equal to if ( a == b ) { alert ('Hello World') ; } The reason is that the most of the languages ignores the whitespace file compiling the code.
document.getElementById("textfields").innerHTML += '<B><FONT SIZE=2>Item '+numItems+' </B>Barcode <INPUT TYPE="text" NAME="textfield2" VALUE="" > <A HREF="cca-assembly.php"><IMG SRC="C:/Server/Apache2/htdocs/Images/down_arrow.gif" HEIGHT=19 WIDTH=20 ALIGN=TOP></A><BR></B>Description <INPUT TYPE="text" NAME="textfield2" VALUE=""> Part Number <INPUT TYPE="text" NAME="pnotextfield" VALUE=""> Serial Number <INPUT TYPE="text" NAME="serialnofield" VALUE"" ONKEYDOWN="if (event.keyCode==9) { addNewItem(); }"><A HREF="cca-assembly.php"><IMG SRC="C:/Server/Apache2/htdocs/Images/down_arrow.gif" HEIGHT=19 WIDTH=20 ALIGN=TOP> </A><BR>'; Code (markup):
Try this (or sth like this format): document.getElementById("textfields").innerHTML += '<B><FONT SIZE=2>Item ' + numItems + ' </B>Barcode <INPUT TYPE="text" NAME="textfield2" VALUE="" >' + ' <A HREF="cca-assembly.php"><IMG SRC="C:/Server/Apache2/htdocs/Images/down_arrow.gif"' + ' HEIGHT=19 WIDTH=20 ALIGN=TOP></A><BR></B>Description <INPUT TYPE="text" NAME=' + '"textfield2" VALUE=""> Part Number <INPUT TYPE="text" NAME="pnotextfield" VALUE=""> ' + 'Serial Number <INPUT TYPE="text" NAME="serialnofield" VALUE"" ONKEYDOWN="if ' + '(event.keyCode==9) { addNewItem(); }"><A HREF="cca-assembly.php"><IMG ' + 'SRC="C:/Server/Apache2/htdocs/Images/down_arrow.gif" HEIGHT=19 WIDTH=20 ALIGN=TOP> </A><BR>'; Code (markup):