Board index   FAQ   Search  
Register  Login
Board index php forum :: HTML JavaScript

Problem string

Javascript coding ..

Moderators: macek, egami, gesf

Problem string

Postby southriver » Thu Jun 02, 2005 2:28 am

i have string in js :

str=' have a nice
day';
document.write(str);

View in browser , result is empty.

I want convert this statement code to :

str=' have a nice day';
document.write(str);

View in browser , result is "have a nice day".

I think error with string in JS


Please help me :help:
Thks
User avatar
southriver
New php-forum User
New php-forum User
 
Posts: 51
Joined: Sun May 29, 2005 8:31 pm

Postby Redcircle » Thu Jun 02, 2005 12:25 pm

I've notice that.. JS doesn't like the return character. have it on one line. if php is outputting the code do a str_replace("\n","", $code)
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Postby southriver » Thu Jun 02, 2005 5:46 pm

i want "have a nice day" string only inline
"have a nice
day" => "have a nice day"
i used str_replace("\n","",$string) but result not change.
User avatar
southriver
New php-forum User
New php-forum User
 
Posts: 51
Joined: Sun May 29, 2005 8:31 pm

Postby Alexej Kubarev » Fri Jun 03, 2005 1:39 am

okej... try replacing \r as well :)
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby Alexej Kubarev » Fri Jun 03, 2005 1:40 am

your JS is outputed by PHP, right?
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby southriver » Fri Jun 03, 2005 5:08 pm

that's right , js is outputed by PHP
User avatar
southriver
New php-forum User
New php-forum User
 
Posts: 51
Joined: Sun May 29, 2005 8:31 pm

Postby southriver » Fri Jun 03, 2005 5:28 pm

that's great , thanks :)
User avatar
southriver
New php-forum User
New php-forum User
 
Posts: 51
Joined: Sun May 29, 2005 8:31 pm

Postby Alexej Kubarev » Fri Jun 03, 2005 11:33 pm

did it work?
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län

Postby southriver » Sun Jun 05, 2005 10:55 pm

okie , it have been worked
thks
User avatar
southriver
New php-forum User
New php-forum User
 
Posts: 51
Joined: Sun May 29, 2005 8:31 pm

Postby Alexej Kubarev » Mon Jun 06, 2005 2:05 am

Thats just great news then :)
User avatar
Alexej Kubarev
Site Admin
Site Admin
 
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län


Return to JavaScript

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron