Jump to content
xisto Community
Sign in to follow this  
minnieadkins

Formatting Alerts/confirm In Firefox 1.5.0.1

Recommended Posts

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:

<HTML><HEAD><TITLE></TITLE><script type="text/JavaScript" language="JavaScript"><!--function test(){alert("\t\tCENTER!\t\t");}--></SCRIPT></HEAD><BODY onload="test();"></BODY></HTML>

Share this post


Link to post
Share on other sites

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:

alert("    CENTER!    ");

Share this post


Link to post
Share on other sites

hey minnieadkins,

This doesn't have tab stops, so lining up elements would be troublesome, but you can do:

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

Share this post


Link to post
Share on other sites

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:

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! .

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.