www.webdeveloper.com
Results 1 to 6 of 6

Thread: [RESOLVED] IE Explorer text runs together, fine in FireFox ?

Hybrid View

  1. #1
    Join Date
    Sep 2008
    Location
    Jackson MS
    Posts
    373

    resolved [RESOLVED] IE Explorer text runs together, fine in FireFox ?

    I have been modifying an array called lines and these are the last few lines before the function finishes. The user has to copy the selected text to the clipboard to take it to another program.
    Code:
      document.penta.IOField.value="";
      for (i=0; i < lines.length; i++) {
        document.penta.IOField.value+= lines[i];
        if ((i + 1) < lines.length)
    	  document.penta.IOField.value+= "\n"; }	
        document.penta.IOField.select();
    If the clipboard is pasted into Notepad, the data are not separated into lines when using Internet Explorer, but I have no problem with FireFox.

    Also, under the "How to Use" button, the window opened in Firefox is just large enough while with IE, there is a lot of unused space. Am wondering why that is.

    The page is Spacer.htm and a few lines of any text and any option should help test it.

  2. #2
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    Turning "\n" into "\r\n" could solve your copy/paste problem.

  3. #3
    Join Date
    Sep 2008
    Location
    Jackson MS
    Posts
    373
    Just tried to add
    Code:
    var newLine = (this.navigator.appName.slice(0,8) == "Netscape")? "\n" : "\r\n";
    and use newLine in place of "\n" in the code from my first message, but it didn't change anything.

    Thanks for looking at it.

  4. #4
    Join Date
    Sep 2008
    Location
    Jackson MS
    Posts
    373
    The following works in both FireFox and IE when the text area is selected and copied via clip to notepad. I had been expecting 100 "test" on one line from IE.
    Code:
    <html>
    <head><title>test program</title>
    <script language="JavaScript">
    function myStart() {
    var myArea="",i,j;
    for (i=0; i < 10;i++) {
      for (j=0; j < 10; j++) {
        myArea += "test "; }
      myArea += "\n"; }
    document.aform.textfield.value = myArea;
    }
    </script>
    </head>
    <body onload="myStart()">
    <form name="aform">
    <table><tr><td>
    <textarea cols="130" rows="28" name="textfield"></textarea>
    </td></tr></table>
    </form>
    </body>
    </html>

  5. #5
    Join Date
    Sep 2008
    Location
    Jackson MS
    Posts
    373

    resolved

    Finally got it figured out, but don't know why it works. Just removed
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    from the top.

  6. #6
    Join Date
    Aug 2008
    Location
    Sweden
    Posts
    227
    That's very odd. A doctype declaration is something you always should have though... Doesn't it work if you use transitional instead of strict?
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles