Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Formatting Alerts/confirm In Firefox 1.5.0.1
minnieadkins
post Feb 9 2006, 06:04 PM
Post #1


Premium Member
Group Icon

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>
Go to the top of the page
 
+Quote Post
miCRoSCoPiC^eaRt...
post Feb 10 2006, 04:14 AM
Post #2


PsYcheDeLiC dR3aMeR
Group Icon

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 &nbsp; character which represents a single space. So in effect, putting four or eight of &nbsp; in a row would give you your typical tab.

Example:
CODE

alert("&nbsp;&nbsp;&nbsp;&nbsp;CENTER!&nbsp;&nbsp;&nbsp;&nbsp;");

Go to the top of the page
 
+Quote Post
mastercomputers
post Feb 10 2006, 05:03 AM
Post #3


PESTICIDAL MANIAC
Group Icon

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
Go to the top of the page
 
+Quote Post
Jack Cheng
post Mar 1 2006, 12:17 AM
Post #4


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 12
Joined: 16-February 06
Member No.: 11,335



QUOTE(miCRoSCoPiC^eaRthLinG @ Feb 9 2006, 11:14 PM) *

Umm i dunno about the \t tab, and I know whitespace " " will be ignored. Your quick and dirty solution would be to use the &nbsp; character which represents a single space. So in effect, putting four or eight of &nbsp; in a row would give you your typical tab.

Example:
CODE

alert("&nbsp;&nbsp;&nbsp;&nbsp;CENTER!&nbsp;&nbsp;&nbsp;&nbsp;");




The &nbsp; 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 &nbsp;&nbsp;&nbsp;&nbsp;CENTER!&nbsp;&nbsp;&nbsp;&nbsp;, instead of Center! .

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Firefox Tab Position(3)
  2. Mozilla Firefox And Runescape(10)
  3. Web Browsing With Vim(2)
  4. How To Set-up A Proxy In Ie And Firefox(4)
  5. Disable /change The Find In Page Sound In Firefox(1)
  6. Firefox Update(7)
  7. Opera(52)
  8. Windows Internet Explorer 7 Vs. Mozilla Firefox 2(28)
  9. Firefox 2(5)
  10. Internet Explorer 7 Problem(8)
  11. Disable Crash Recovery Restore Session Option On Firefox 2(3)
  12. Firefox 2 Has A Spell Check!(40)
  13. Firefox Plugins For Web Developers(14)
  14. Settimeout() & Focus() Not Working With Firefox(1)
  15. Firefox Addon(9)
  1. Bookmarks (firefox)(2)
  2. Firefox Problems..(6)
  3. Firefox Performance Stats(3)
  4. Opera Vs. Firefox Vs. Internet Explorer(10)
  5. E-mail - Firefox(6)
  6. Recognizing Third-party Content In Firefox(2)
  7. Firefox Addon Check(2)
  8. Firefox 3(19)
  9. Safari, Firefox And Dns Client Service Behaviour(1)
  10. Css With Firefox(5)
  11. Css Background Not Showing Upin Ie(6)
  12. Make Firefox Look Like Google Chrome(2)
  13. Firefox Dream Packages - Condense(0)


 



- Lo-Fi Version Time is now: 2nd December 2008 - 09:39 PM