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 AuthorSocial security policy changes impact retiree benefits
Rashan Dixon May 2, 2024 5:43 PMFinancial anxiety rises among US adults, says AARP study
Noah Nguyen May 2, 2024 5:01 PMGame Pass refreshes library with exciting additions
Johannah Lopez May 2, 2024 3:25 PMGoogle’s pixel 8 pro adopts minimalistic camera finish
Johannah Lopez May 2, 2024 1:48 PMApple’s new Beats Solo Buds offer affordable audio quality
Rashan Dixon May 2, 2024 1:23 PMDouble social security payments expected certain months
April Isaacs May 2, 2024 11:57 AMMarket anticipates Federal Reserve’s rate decision
Rashan Dixon May 2, 2024 11:29 AMBitcoin remains sturdy amid crypto market turbulence
Johannah Lopez May 2, 2024 8:09 AMBinance founder sentenced to prison, steps down as CEO
Noah Nguyen May 2, 2024 7:10 AMU.S. stock futures dip, challenging market optimism
Rashan Dixon May 1, 2024 5:20 PMInadequate information delays necessary assistance
Johannah Lopez May 1, 2024 5:15 PMJune’s social security payments released early
April Isaacs May 1, 2024 3:30 PMFinancial instability grows among aging Americans
Johannah Lopez May 1, 2024 3:27 PMGoogle improves split-screen mode for Pixel devices
Cameron Wiggins May 1, 2024 11:52 AMApple AirPods Pro now at lowest price on Amazon
April Isaacs May 1, 2024 11:44 AMHSBC’s CEO Noel Quinn set to depart
Rashan Dixon May 1, 2024 11:39 AMLeaked designs hint at unique iPhone 16 features
April Isaacs May 1, 2024 11:13 AMYen’s value drops, stirs global market concerns
Johannah Lopez May 1, 2024 7:26 AMBoost your business empowers small enterprises
Rashan Dixon April 30, 2024 5:40 PMOil prices drop amidst easing Middle East tensions
Rashan Dixon April 30, 2024 5:26 PMNational Small Business Week celebrates resilience and innovation
April Isaacs April 30, 2024 5:16 PMHow to Create and Deploy QR Codes Online: A Comprehensive Guide
Rashan Dixon April 30, 2024 5:04 PMCircle fintech firm announces major changes, resumes stablecoin use
Cameron Wiggins April 30, 2024 3:06 PMBeauty mogul Jackie Aina shares Forvr Mood entrepreneurial insights
Rashan Dixon April 30, 2024 1:28 PMFrom cart to cafes: Nitro Bar’s inspiring journey
Cameron Wiggins April 30, 2024 11:40 AM