Firefox hide/reveal text local page in linux not windows

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Post Reply
SteveH_66
Posts: 16
Joined: February 25th, 2012, 7:53 am

Firefox hide/reveal text local page in linux not windows

Post by SteveH_66 »

I did a websearch, and found a page that showed you how to hide and reveal text on a webpage. The person viewing the webpage just clicked on the text and voila - the hidden text was revealed. Very simple to do, you put a block of javascript in the <head> section, put one piece of code in on the piece of text, like a list item you want to have a description for, then put another piece of code in on the element you want to hide/reveal when the item is clicked and bada boom, bada bing - it works! But not so fast, it worked just fine in Linux, on a Live CD not even a full install. But in Windows? Nope. Nada. Nix. No Go Joe. It works locally in Linux, useful for viewing your webpages before you post them publicly, or just even for local use only. But not Windows.

I don't know much about Linux, have just been using Live CD's to check it out, and did install Mint once to try it out in a full install. I know Linux comes with all kinds of stuff already there - probably PHP, Python, etc. just there and ready to go.

I know Windows comes with very little installed, although I am not a power user. So, being a regular user (put the key in, turn it,start it, drive away) not a power user (now this is how the super neutron flux capacitor works in Windows), I need to ask here. What do I need to install in Windows so that this kind of thing is possible in a local page in Firefox on Windows? I really wish this kind of thing was taken care of by default in Windows, worked right out of the box like it does in Linux. Thanks for any assistance anyone can provide on this question, Steve

Edit : This is very cool and easy to do when making webpages, if anyone can tell me what to install so it works in windows. If anyone wants to see how it's done, here is a link to the page describing how the hide/show text thing works on a webpage http://www.toptip.ca/2009/09/showhide-text-on-web-page.html
User avatar
Dartman
Moderator
Posts: 11995
Joined: February 9th, 2006, 9:43 pm

Re: Firefox hide/reveal text local page in linux not windows

Post by Dartman »

Moved to Web Development
Last edited by Dartman on March 20th, 2015, 6:33 pm, edited 1 time in total.
Reason: edited post and moved again
Alcohol and Calculus don't mix. Never drink and derive.
rsx11m
Moderator
Posts: 14404
Joined: May 3rd, 2007, 7:40 am
Location: US

Re: Firefox hide/reveal text local page in linux not windows

Post by rsx11m »

That code works for me as advertised on Windows with SeaMonkey 2.33 and Firefox 31.5.0 ESR as well, putting it into a local HTML file. It shouldn't depend on the platform but rather on the browser where that code is actually executed.
SteveH_66
Posts: 16
Joined: February 25th, 2012, 7:53 am

Re: Firefox hide/reveal text local page in linux not windows

Post by SteveH_66 »

I am using Firefox version 36.0.3 and as I said, it isn't working. I find it very odd as well, although the Linux Live CD I was using has an older version of Firefox on it as well, I think it too might be the ESR version. I'm wondering if the newer versions of Firefox broke something? Or if it is just something about Firefox on my Windows 7 system that is causing the problem. The page does not work correctly in Internet Explorer either on my system. You are sure it should work in Firefox without something else installed? Are you a web developer with PHP or some other scripting language or something else installed in your Windows? Thanks
User avatar
trolly
Moderator
Posts: 39851
Joined: August 22nd, 2005, 7:25 am

Re: Firefox hide/reveal text local page in linux not windows

Post by trolly »

Just a guess but the asynchronous rendering of firefox often leads to problems because some scripts immediately in the page source are executed before the element they work on is rendered.
There are several ways to make it work reliable with e.g. timers or handlers.

Maybe that's the cause here.
Think for yourself. Otherwise you have to believe what other people tell you.
A society based on individualism is an oxymoron. || Freedom is at first the freedom to starve.
Constitution says: One man, one vote. Supreme court says: One dollar, one vote.
SteveH_66
Posts: 16
Joined: February 25th, 2012, 7:53 am

Re: Firefox hide/reveal text local page in linux not windows

Post by SteveH_66 »

Well, this is odd. I deleted the local copy of that webpage, went to the site and saved it again. Now it is working correctly as a local file, it was originally saved as a MAFF file, don't know how that could cause this, but saved as HTML only it does work now. And copying and pasting the code from that page into a simple webpage I did in a text editor, the simple page I created is also working correctly in Firefox and IE both on my system now as well. Don't know what the problem was, but this seems to have fixed it. Thanks for the help you provided rsx11m, it is much appreciated.
SteveH_66
Posts: 16
Joined: February 25th, 2012, 7:53 am

Re: Firefox hide/reveal text local page in linux not windows

Post by SteveH_66 »

Thanks for the reply and the interesting information trolly. As I stated in my last post, somehow deleting it and re-saving it as html only worked to fix the problem. But could you explain more about how to do a timer or handler in a webpage? Like what kind of code it is (javascript, HTML, etc.). If you don't feel like explaining more in depth, I could then do a search for information on how to do the timers and handlers. I really know little more than how to do simple webpages in a text editor or Kompozer :)
rsx11m
Moderator
Posts: 14404
Joined: May 3rd, 2007, 7:40 am
Location: US

Re: Firefox hide/reveal text local page in linux not windows

Post by rsx11m »

You are welcome. I have no clue what MAFF is ("Mozilla Archive Format" Wikipedia says, needs to be handled by some extension), but a "live" web page should have an HTML type for it to work.

FYI: JavaScript is interpreted in the browser, whereas PHP is interpreted on the server (also, SeaMonkey 2.33 is on the same patchlevel as Firefox 36.0.1 despite the different versioning, thus our tests were almost equivalent).
SteveH_66
Posts: 16
Joined: February 25th, 2012, 7:53 am

Re: Firefox hide/reveal text local page in linux not windows

Post by SteveH_66 »

Hi rsx11m, MAFF let's you get a download of a page along with everything connected to it that can be downloaded from the site, including images in the page and I think maybe it allows you to get some other things from the page. Like that Microsoft file format that lets you get the page and everything in it as one archive I think. That's what was puzzling me, I thought I had read that about Javascript working in the browser on some site, and I knew php was server side, so I couldn't figure out why it wasn't working right. Well, thanks again for your help even though it turned out to be a simple mistake and nothing wrong with the system or browser.
Post Reply