|
|
|
|
![]() ![]() |
Feb 9 2006, 06:04 PM
Post
#1
|
|
|
Premium Member Group: Members Posts: 292 Joined: 15-December 04 Member No.: 1,768 |
I was trying to use the \t to tab in Firefox 1.5.0.1. It works in IE 6. I haven't tried it in other other browser, but I was wondering if there's something I'm doing wrong. I tried a simple test page to see if it was my script, and the test page gave me the same results. It worked in IE6 but not Firefox.
I also tried putting in " " for tabs instead of using the \t escape. Firefox just ignores the white space I guess. Any ideas on formatting it? I'll post the test I did: CODE <HTML>
<HEAD><TITLE></TITLE> <script type="text/JavaScript" language="JavaScript"> <!-- function test(){ alert("\t\tCENTER!\t\t"); } --> </SCRIPT> </HEAD> <BODY onload="test();"> </BODY> </HTML> |
|
|
|
Feb 10 2006, 04:14 AM
Post
#2
|
|
|
PsYcheDeLiC dR3aMeR Group: Admin Posts: 2,242 Joined: 29-January 05 From: Nakorn Chaisri, Thailand Member No.: 2,411 myCENTs:84.36 |
Umm i dunno about the \t tab, and I know whitespace " " will be ignored. Your quick and dirty solution would be to use the character which represents a single space. So in effect, putting four or eight of in a row would give you your typical tab.
Example: CODE alert(" CENTER! "); |
|
|
|
Feb 10 2006, 05:03 AM
Post
#3
|
|
|
PESTICIDAL MANIAC Group: Members Posts: 626 Joined: 1-September 04 From: Auckland, New Zealand Member No.: 27 |
hey minnieadkins,
This doesn't have tab stops, so lining up elements would be troublesome, but you can do: CODE var tab = '\u2003\u2003\u2003\u2003'; var replacement = /\t/g; var string = 'this is a\t test str\ting'.replace(replacement, tab); alert(string); It's unfortunate that FF and a lot of other browsers remove this whitespace. Cheers, MC |
|
|
|
Mar 1 2006, 12:17 AM
Post
#4
|
|
|
Newbie [ Level 2 ] Group: Members Posts: 12 Joined: 16-February 06 Member No.: 11,335 |
Umm i dunno about the \t tab, and I know whitespace " " will be ignored. Your quick and dirty solution would be to use the character which represents a single space. So in effect, putting four or eight of in a row would give you your typical tab. Example: CODE alert(" CENTER! "); The is specific only to HTML. In javascript, it is rendered as is - it is not changed to a space (so the message in the alert box is CENTER! , instead of Center! . |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 2nd December 2008 - 09:39 PM |