» Let's say you have two radio buttons
<form name = "theForm"> <input type = "radio" name = "heyzeus"> Remember Me <br><br> <input type = "radio" name = "heyzeus"> Forget Me </form>
Javascript creates a zero based array/object/collection/whatever called 'heyzeus' (or whatever you've named the radio buttons), which can be accessed in javascript as follows.
document.theForm.heyZeus
Of course, that does you no good, as it will return a value of [object]. To determine which button is checked, used the following syntax.
document.theform.heyZeus[0].checked document.theform.heyZeus[1].checked
The order of the radio buttons in the collection is determined by the order of their appearance in the html code. Therefore, in this example heyzeus[0] refers to the radio button next to 'Remember Me', and heyzeus[1] refers to the button next to 'Forget Me'.
So, in your memory() function, you should have something like this
if(document.theform.heyZeus[0].checked == true)( //do remember me stuff ) else if(document.theform.heyZeus[1].checked == true)( //do forget me stuff )
You'll be quizzed on this next Monday.
Alan { 9.19.01 @ 7:05pm }
» Crap, the name of the form should be all lowercase, like so
Figures I'd miss that in the first five previews
alan { 9.19.01 @ 7:07pm }
» *sigh*
<form name = "theform">
alan { 9.19.01 @ 7:08pm }
» Alan, I think I love you.
Off to tweak javascript....
Derek M. Powazek { 9.19.01 @ 10:29pm }
» I do believe it's fixed. Thank you SO much Alan!
If anyone has any problems with this feature, please post them here. Thanks!
Derek M. Powazek { 9.19.01 @ 10:40pm }
» Glad you got it sort it. Also glad my silly loopy-from-jetlag posts were removed!
Tom Cosgrave { 9.20.01 @ 8:53am }
» And here's a little tip for making the form elements a little more user friendly. Add an id to the radio button and put a label tag around the text next to it that references that id. Like so:
remember me
That way, when you click on remember me, the radio button will check (meaning that it works more like a radio button should). I know this works on IE4+ on the PC...not sure about other browsers on other platforms.
(I think you could also add a style to the text so that the cursor turns into a hand when you mouse over it (because it currently doesn't for some reason.))
jkottke { 9.20.01 @ 9:17am }
» Oh for crying out loud...here's the code:
<input TYPE="radio" NAME="cookieme" value="bake" id="chocolate"> <label for=chocolate>remember me</label>
jkottke { 9.20.01 @ 10:04am }
» Heh. Yeah. These forms aren't great for code, eh?
Anyway, Jason, thanks! I just added the labels. And they work! Woohoo!
Derek M. Powazek { 9.20.01 @ 10:06am }
» Just another idea for a comment feature I thought of:
Because I sometimes like to read other people's comments in response to my own, I added a feature to my own weblog which is basically a checkbox saying: [email me future responses to this entry]. Backend-wise, all the server does is add the submitter's email to a list in a table related to each entry. So, when a future user submits an entry, the server crossreferences the list of emails for each entry that want to hear about it and it sends them an email. Of course, I have yet to implement I 'remove' feature, but it shouldn't be difficult to include a URL in the email that automatically passes a command to the server to remove that email from the reply list.
MaTias { 9.20.01 @ 10:57am }
» in trying times, desparate hands click 'remember me' in the hopes that their spirits may be maintained; and yet, in times of utter despair, one finds oneself compelled to click 'forget me', obsessively, to no gratifying effect.
maybe some explanation of what the text for the radio buttons means besides them would be good? (i.e. this will store your name/email/url settings, or prevent the browser from doing so.)
otherwise, it looks good. i appreciate the ability to delete the cookie. some of the other comment systems i've used (blog voices? i don't know the name of it) store a cookie but don't give you the option to delete it, or not store it in the first place. maybe that's just an option of the site's maintainer (no offense to the blog voices person if they didn't write things explicitly so).
moz { 9.20.01 @ 2:19pm }
» Moz - Good idea! I added title tags to Jason's labels. Mouse over, baby!
(I love this collaborative tweaking....)
Derek M. Powazek { 9.20.01 @ 3:05pm }
» Thanks for the point out Derek.
Dan { 9.21.01 @ 8:31am }
» hmm..I seem to be having problems with the forget me option
Dan { 9.21.01 @ 9:49am }
» oooh.. I like it.. I like it
Kevin-John { 9.21.01 @ 10:26pm }
» Thank you, Derek, for making this happen and sharing with the rest of us!
eric { 10.10.01 @ 10:41am }
|