Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Javascript - Firefox - document.write

Options
  • 24-04-2010 1:47am
    #1
    Registered Users Posts: 3,849 ✭✭✭


    Hello all.

    I'm no javascript expert so I'm sorry if my question is basic or stupid.

    I have a website which works great in all browsers except Firefox.
    www.fakeword.com

    The randomly generated words are supposed to be displayed with new paragraphs between each, but in Firefox, the words are just spewed together.

    The code is in the source. It goes something like this:
    document.write( createRandomWord(5) );
    document.write("</P>");
    document.write( createRandomWord(8) );
    document.write("</P>");

    I'm hoping the solution to my problem is straightforward.

    Thanks in advance for any help whatsoever!

    Declan


Comments

  • Registered Users Posts: 168 ✭✭php-fox


    You are missing an opening P tag.

    Each word must have an opening P tag and the closing eg, <p>your word</p>

    And it's very interesting that FF ignores stand alone closing tags without an opening tag. The rest of them (IE, chrome, safari) deal fine with it. Maybe too assumption really...


  • Closed Accounts Posts: 7,145 ✭✭✭DonkeyStyle \o/


    ^ Aye, could use summit like this to save you a few lines...
    document.write( '<p>' + createRandomWord(5) + '</p>');
    


  • Registered Users Posts: 3,849 ✭✭✭condra


    Thanks for taking the time to reply guys. Sorted now! :)


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    That's a cool site. Would you add a *like* feature, so you get fake words like the submitted word? You know, like Flickr for flicker that sort of thing.


  • Registered Users Posts: 3,849 ✭✭✭condra


    Evil Phil. I'm glad you like the site. I'm hoping to develop it further to include different types of "generators", and I appreciate your (great) idea.

    Other ideas I've had are things like generating fake scientific/sci-fi names, band/artist names, etc.

    The next step i want to take is to get the Javascript out of the HTML code and place it in a separate JS file. Then I'll go to work on some more generators, better design, ad some relevant, unobtrusive monetization features, and go about promoting it.


  • Advertisement
  • Closed Accounts Posts: 5,082 ✭✭✭Pygmalion


    php-fox wrote: »
    And it's very interesting that FF ignores stand alone closing tags without an opening tag. The rest of them (IE, chrome, safari) deal fine with it. Maybe too assumption really...

    To be fair, there's no right way to deal with it.
    The assumption that it should be treated as a paragraph (and the starting tag was mistakenly omitted) is as valid as the assumption it shouldn't (and the closing tag was mistakenly inserted).

    This is why we have standards, you can't claim a browser is in the wrong to display a website differently to expected unless the website actually follows those standards.


Advertisement