Advanced Search

Results 1 to 2 of 2

Thread: echo line breaks within <script>

  1. #1
    Join Date
    Jan 2008
    Posts
    441
    Thanks
    67
    Thanked 4 Times in 4 Posts

    Default echo line breaks within <script>

    ive tried "\n" but i dont get line breaks. how can i break each line?

    Code:
    	echo '<script>';
    	echo "$('#socialQues').load('ques/ques1.php');";
    	echo '$("#socialSubjTitle").animate({"left": "24px"}, "fast");';
    	echo '$("#socialSubj").animate({"left": "74px"}, "fast");';
    	echo '$("#socialQues").fadeIn(0);';
    	echo '$("#socialQues").animate({"left": "264px"}, "fast");';
    	echo '</script>';

  2. #2
    Join Date
    Jan 2008
    Posts
    4,103
    Thanks
    18
    Thanked 615 Times in 611 Posts
    Blog Entries
    5

    Default

    You have to use double quotes "\n" to make a line break, or concatenate it (which is what I recommend in your case). For example:
    Code:
    echo 'Hello!'."\n";
    You can only use \n with double quotes just as you can only use variables without concatenating in double quotes.

    Good luck

  3. The Following User Says Thank You to Nile For This Useful Post:

    ggalan (01-06-2011)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •