User Profile
Collapse
-
Hi gits, I've now replaced the text(between the 's in the alert box) with a variable. Had problem getting this to work until I entered the variables in the <script> section of the page <head>. I couldn't use double quotes in your example because all this snippet was inside a set of doubles to produce a row of a table. The project is for in-house so whatever works without bringing down the ceiling should be OK. The \\n works in the text... -
Many thanks gits but that doesn't work, the problem is how html reads the script passed over from js - but I've now sussed it (after a few hours) -- the \n needs an escape in front of it ie \\n.
Posted for others is the part of document.write that applies (note the quotes):
"<table><tr><td ><a href onclick=alert(' Some list\ \nhere')>The list</a></td></tr></table>"....Leave a comment:
-
line breaks in alert box from html script
I'm building an HTML page with javascript. All is fine in the document.write until I want to create an alert box from an onClick on the page.
Here's the script(part) so far:"<td><a href onclick=alert(' Some list& nbsp;here')>The list</a></td>".
This brings back alert box with - Some list here - OK but I want a line break where the second is. I've tried all the \n \r <br>...
No activity results to display
Show More
Leave a comment: