Question:
I am trying to use document.writeln to write a table onto a floating menu bar. Part of the table cell’s events is Java code. When it reaches the semicolons in the code for the table, it thinks it is the end of the line. How can I pass semicolons in document.writeln so JavaScript knows it’s not at the end?
document.writeln ('Answer:
The semicolons aren't the object that's causing you trouble if I'm reading your code correctly?you're mixing single and double quotes in a nested fashion. This is okay, but you're enclosing single quotes in double quotes and then, again, in single quotes. The inner single quotes are being treated as the end of the string.
Instead of this code:
String = ' outer = " inner ' really inner' " ';Try:
String = ' outer = " inner ' really inner' " ';The JavaScript engine knows to treat the quote following the backslash as a literal value rather than to interpret it as the end of the string.
About Our Editorial Process
At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.
See our full editorial policy.
About Our Journalist
Charlie Frank
Charlie has over a decade of experience in website administration and technology management. As the site admin, he oversees all technical aspects of running a high-traffic online platform, ensuring optimal performance, security, and user experience.View AuthorAnticipating Bitcoin’s halving: impacts and strategies
Rashan Dixon April 19, 2024Nothing startup integrates ChatGPT into devices
Rashan Dixon April 19, 2024Google Maps enhances search for EV charging stations
Cameron Wiggins April 19, 2024Upcoming social security payments scheduled by birth dates
Rashan Dixon April 19, 2024Retirees to receive double Social Security payments soon
Noah Nguyen April 19, 2024Proposed Act Aims to Adjust Social Security for Seniors
Rashan Dixon April 19, 2024Anticipating Bitcoin’s halving: impacts and strategies
Rashan Dixon April 19, 2024 5:39 PMNothing startup integrates ChatGPT into devices
Rashan Dixon April 19, 2024 5:06 PMGoogle Maps enhances search for EV charging stations
Cameron Wiggins April 19, 2024 1:28 PMUpcoming social security payments scheduled by birth dates
Rashan Dixon April 19, 2024 1:07 PMRetirees to receive double Social Security payments soon
Noah Nguyen April 19, 2024 11:59 AMProposed Act Aims to Adjust Social Security for Seniors
Rashan Dixon April 19, 2024 8:33 AMUSD/JPY stability holds amidst market ambiguities
Cameron Wiggins April 19, 2024 8:27 AMSilver prices surge amid increasing demand
Rashan Dixon April 19, 2024 7:52 AMIs Online Bookkeeping the Ideal Side Gig for Remote Workers?
Kyle Lewis April 18, 2024 2:49 PMGlobal stock stability amid rising US interest rates
Rashan Dixon April 18, 2024 1:44 PMRivos Inc. raises $250 million pre-launch for AI chips
Noah Nguyen April 18, 2024 1:19 PMGoldman Sachs advises caution in predicting Bitcoin prices
Cameron Wiggins April 18, 2024 1:14 PMPredicted rise in social security benefits amid inflation
Noah Nguyen April 18, 2024 1:09 PMGold prices dip amid assertive fiscal comments
Johannah Lopez April 18, 2024 11:46 AMVorlon raises $15.7M to strengthen API security
Noah Nguyen April 18, 2024 11:28 AMLast April social security disbursement approaching
Johannah Lopez April 18, 2024 11:16 AMRippling to pursue substantial funding round
Johannah Lopez April 18, 2024 8:33 AMSimpson’s lawyer battles to protect estate from Goldmans
Noah Nguyen April 18, 2024 8:31 AMApril’s Social Security retirement payments underway
Cameron Wiggins April 17, 2024 5:54 PMRivian develops software to rank EV chargers
Rashan Dixon April 17, 2024 5:50 PMSimpson’s will leaves Goldman family uncompensated
April Isaacs April 17, 2024 5:26 PMFramework grapples with software sustainability issues
Noah Nguyen April 17, 2024 3:44 PMSurprising economic growth attributed to China’s robust exports and domestic demand
Rashan Dixon April 17, 2024 3:04 PMCOBOL at 65: still a powerhouse in the tech industry
Cameron Wiggins April 17, 2024 1:59 PMCalifornia’s minimum wage hike worries restaurateurs
Noah Nguyen April 17, 2024 1:05 PM