/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Multi-Line alert

I’d like to have two lines of text in an alert box, so I tried this:

[code=php]
alert(“Welcome to the site!nEnjoy Your stay!”);[/code]

It works just fine in WIE7, and last night it worked in FF. But now for some reason, FF either does absolutely nothing with it, or pops up a box saying “Welcome to the site!Nan”
Anyone know how I can get this fixed?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@KorOct 26.2006 — There is no reason for it should not work in anybrowser on this world. Maybe your FF is damaged or virused, things like that. It is not possible like something to have worked yesterday and stop working now, except if you have changed the code, removed something my mistake, mistyped...)
Copy linkTweet thisAlerts:
@AmazingAntauthorOct 26.2006 — 
changed the code
[/quote]

Not so much changed it, as put it inside the setTimeout function.

But that's ok. This works:
[code=php]
setTimeout(function(){alert("Welcome to the Site!nEnjoy Your Stay!")},5000);[/code]

Thanks~
Copy linkTweet thisAlerts:
@KorOct 26.2006 — See, you have [I]changed[/I] the code, as this is a major changing, because as a setTimeout parameter, the function/method becomes a quoted object (a sort of string, if you want...)

Yes, using an anonymous as parameter is a good method.
Copy linkTweet thisAlerts:
@AmazingAntauthorOct 26.2006 — Yes, using an anonymous as parameter is a good method.[/QUOTE]
Wasn't my idea, but thanks anyway.
×

Success!

Help @AmazingAnt spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...