« 19 February 2002 « - Back | Archives | Next - » 18 March 2002 » |
OS X againMacOS X 10.1.3 is out. I'm going to wait to update until I do another backup and have at least a small period of downtime.MacinTouch and MacFixit have reader reports of various problems (mostly for people who mess with their system in ways I don't) but also news of improvements and snappier performance. I can hope... Is Javascript On or Off?Turns out there's a more straightforward way to do what I wanted, with no need for style sheets or putting scripts in the<head> or ... (thanks to Matt W.)(Follow the comment link to read about the overly-complicated stylesheet-manipulating JavaScript I threw together the other day to do the same thing in a worse way...) I made a low-tech but useful JavaScript for myself the other day. On the page my browser opens to first, I wanted a way to immediately see if JavaScript is on without going into IE's (or Opera's) menus or preferences to check. I know of no browser (except possibly some branch of Mozilla I haven't seen) which has a status indicator specifically for that piece of information. So I made one. One caveat -- it only works if you have style sheets enabled. (But it seems most folks do.) The result looks like this: [disabled because I kept getting some weird errors from it] JavaScript is ON OFF(Turn on or off JavaScript and reload to see the difference.) So far I've seen it work in IE6/Windows, Opera 6/Windows, Mozilla 6/Mac and IE 5.1/MacOSX, so there's a decent chance it'll work in plenty of other browsers. 'Working' is defined as showing the red 'ON' when you load the page with JavaScript turned on. Anyone not interested in the code can stop reading now... This goes between your page's <head> tags (or put just the function in an external script, like I did for this very page): In your opening <body> tag, add an 'onload ' entry like so: Then somewhere in your main page body, put something like this: You can change the code to display what you like; it's all text and colors, no graphics. Just keep track of the names of your id tags in the <span> s, making sure they match the values in the script. Also, make sure that the colors for 'invisible' pieces match the background of the page (in this case, white). You can obviously play with these values (maybe you want OFF to be red and ON to be green...).
3 comment(s)
The following works without CSS support (ie: even earlier browsers). Just stick it in the body of the document... JavaScript is OFF Throw in tags in the writeln/noscript sections if you want it to look prettier. Re: the mozilla note... with any mozilla, head over to http://xulplanet.com/downloads/view.cgi?category=applications&view=prefbar to get a toolbar that shows and lets you control your javascript enabled/disabled setting (and a couple others). Bummer is that when you upgrade Mozilla, you have to go back to xulplanet to re-install the toolbar. OK, so it was pretty much just an exercise for which there was a better solution sitting out there. Still, I learned stuff doing it. ...and I learned something from your having done it too. I've yet to fiddle with any of that DOM stuff. Looks like you can do some neat stuff with it. :)Add a comment... |
Links, exploration and synthesis from Steve Bogart Photo by my wife RSS Feed / Atom Feed ARCHIVES Medley Seth/Entropy Genehack Kristie/BreachingTheWeb Knotted Knickers Kevin/GhostInTheMachine NRH/Leper Messiah JenB/Divinest Sense Bradlands Andy/Webcrumbs Lilly/GirlHacker rc3.org jjg.net Backup Brain More Like This Scalzi Flutterby WendellWit Q Daily News rebecca's pocket Laurel's TV Picks Recommended: Randall Bramblett: Thin Places Doctors, Professors, Kings & Queens: The Big Ol' Box of New Orleans Tears for Fears: Everybody Loves a Happy Ending Ye olde Wishe Liste |
« 19 February 2002 « - Back | Next - » 18 March 2002 » |