Hello, I am new here. I have found many code snippets on this site so I thought I'd go ahead and register and try to get some help.
I have found javascript snippets to show a form textarea on a checkbox/radio button click. The problem is it doesn't disappear when the checkbox is clicked again (unchecked), and if the page is refreshed, all the textareas start in the default hide state.
Here is what I'm working with:
Code:
<head>
<script type="text/JavaScript">
<!--
function show(id)
{
if (document.getElementById(id).style.display == 'none')
{
document.getElementById(id).style.display = '';
}
}
function hide(id)
{
document.getElementById(id).style.display = 'none';
}
//-->
</script>
</head>
<!doctype html><html><head><script>
function toggle(id) {
if (document.getElementById(id).style.display == 'none') {
document.getElementById(id).style.display = 'block';
} else {
document.getElementById(id).style.display = 'none';
}
}
</script></head><body><form><input type="checkbox" onclick="toggle('Comments')"><br/>
before div
<div id="Comments" style="display:none;"><textarea>insert text here</textarea></div>
after div
</form></body></html>
This is a very basic script! A lot better can be done...!
"It will never rain roses: when we want to have more roses, we must plant more roses."
- George Eliot
//set
$.cookies.set( 'sessid', 'dh3tr62fghe' ); //A cookie by the name 'sessid' now exists with the value 'dh3tr62fghe'
//get
var sessid = $.cookies.get( 'sessid' ); //Variable 'sessid' now holds the value 'dh3tr62fghe'
Would this do the job, and where would I insert each, or how would I do it?
//set
$.cookies.set( 'sessid', 'dh3tr62fghe' ); //A cookie by the name 'sessid' now exists with the value 'dh3tr62fghe'
//get
var sessid = $.cookies.get( 'sessid' ); //Variable 'sessid' now holds the value 'dh3tr62fghe'
Would this do the job, and where would I insert each, or how would I do it?
I know exactly squat about cookies, but once I get a nudge in the right direction I can finger the rest out purty quick. (I have to do all this for my manufacturing facility website, and I'm not a programmer. )
Edit: One quick question after looking at the cookie code.
Code:
<!doctype html>
Does this denote html5, which may or may not cause issues with older browsers, or was this just your shorthand?
This is the top of my header.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
Any problems before I start trial and error and error and error.....
Thank you.
Last edited by Williamsun; 07-29-2012 at 12:40 PM.
As you can see there are some things I'm not sure about, and the only way to find out is to ask. I'm seeing crosseyed from google searches trying to grind out this new order form. Thanks again.
Bookmarks