I have this alert that works: - <script type="text/javascript">
-
var monitor = setTimeout("alert('The monitor is working!');",0);
-
</script>
-
</head>
But I want to turn the alert message into a multiline alert, and when I do this: - <script type="text/javascript">
-
var monitor = setTimeout("alert('The monitor is working!\n\ntest line two');",0);
-
</script>
-
</head>
It doesn't work, any ideas what I'm missing here?
-- PS the timeout is set to 0 for testing purposes only, otherwise it would have a value of 10000
4 1945 gits 5,390
Recognized Expert Moderator Expert
hi ...
you have to escape the backslahes for the linefeed: - setTimeout("alert('The monitor is working!\\n\\ntest line two');",0)
kind regards
ohh, thank you very much. It works great now!
hi ...
you have to escape the backslahes for the linefeed: - setTimeout("alert('The monitor is working!\\n\\ntest line two');",0)
kind regards
Why should I put double slashes?
Please let me know !
Kind regards,
Dmjpro.
gits 5,390
Recognized Expert Moderator Expert
the normal and better way would be: - setTimeout(function() { alert('test\nline2') }, 0)
as you can see here we may use the single slash. but when using: - setTimeout("alert('test\nline2')", 0)
javascript tries to evaluate the string and we get an unterminated string literal:
i think it evals it as a linefeed in our js-code ... so we have to escape the slash again: - setTimeout("alert('test\\nline2')", 0)
and now it is working.
kind regards
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Rasmus Fogh |
last post by:
Dear All,
I need a way of writing strings or arbitrary Python code that will
a) allow the strings to be read again unchanged (like repr)
b) write multiline strings as multiline strings instead of escaping the
\n's.
A repr function that output triple-quoted strings with explicit
(non-escaped) linebreaks would be perfect.
|
by: Krzysztof Fink-Finowicki via .NET 247 |
last post by:
I have problem with TEXTAREA HTML tags in my Web application (MSIE 6.0).
User fills-in content of TEXTAREA on HTML dialog window.
After accepting, content of TEXTAREA from dialog window is copiedto TEXTAREA on main HTML window:
wndTxtArea.value = dlgTxtArea.value;
Then user may take the text for editing in HTML dialog windowonce more.
The problem arises when text to be copied is multiline. Firsttime it is displayed properly after...
|
by: Michael C |
last post by:
Hi all,
I'm trying to add lines to a multiline textbox. Here's what I'd like to end
up with in the textbox (as an example):
Line1
Line2
Line3
I've tried a couple of methods but nothing seems to be working. Code like
|
by: C.McCullough |
last post by:
It appears that the multiline and border properties of a tab control in the IDE on Visual Studio .Net 2003 are broken.
I wanted to set the multiline property of my tab control to true to enable multiple tabs but when I did my project would abort when I tried to run it.
I tried the same thing under Visual Studio 6 and it worked fine so I copied the working project to .Net 2003, compiled it and it also works ok but when I checked the...
|
by: Chris |
last post by:
Hi
We are using style sheets to set the font of our labels and text boxes.
This has been working great until we required a text box with a textmode of
Multiline.
The control picks up the correct font/size until the text mode is changed
from single line to multiline.
We're currently using the H1, H2, H3 and Body tags for the page.
| |
by: Edward Elliott |
last post by:
At the risk of flogging a dead horse, I'm wondering why Python doesn't have
any multiline comments. One can abuse triple-quotes for that purpose, but
that's obviously not what it's for and doesn't nest properly. ML has a
very elegant system for nested comments with (* and *).
Using an editor to throw #s in front of every line has limitations. Your
editor has to support it and you have to know how to use that feature. Not
exactly...
|
by: Brian |
last post by:
I have been working on a data reception system.. I am still finding my
way around Javascript, though I am accomplishing much.
I just fixed a flaw that was really hard to find. The symptoms are
this:
I get a multiline string returned to Javascript from a Proxy+Google
Maps API GDownloadUrl()
The data, when added to a DOM table looked fine, about 20 lines in CSV
format
|
by: Zdenek Maxa |
last post by:
Hi all,
I would like to perform regular expression replace (e.g. removing
everything from within tags in a XML file) with multiple-line pattern.
How can I do this?
where = open("filename").read()
multilinePattern = "^<tag.... <\/tag>$"
re.search(multilinePattern, where, re.MULTILINE)
|
by: vjsv2007 |
last post by:
Can you help to make one alert with all details?
<script type="text/javascript">
<!--
function validate_form ( )
{
valid = true;
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |