L
Leroy Frye
hai all.......
i`m new in javascript...
i got crazy with this script because i was search in many tutorial and
learn online and do "try and error"
for 2 weeks to get variable value but still undefined
how i can get cookies all value without changing this script with
document.cookie?
<script language="javascript" type="text/javascript"><!--
function checkMemberForm24(frm){
if(!validateName(frm.elements['form[first_name]'].value)){
alert('Please enter valid First Name!');
frm.elements['form[first_name]'].focus();
return false;
}
if(!validateName(frm.elements['form[last_name]'].value)){
alert('Please enter valid Last Name!');
frm.elements['form[last_name]'].focus();
return false;
}
if((frm.elements['form[sex]'].value == 'Yes') && (frm.elements['form
[age]'].value == '')){
alert('Age and sex Required!');
frm.elements['form[age]'].focus();
return false;
}
--></script>
<div id="divForm24" class="formContent" id="frmMember24"
name="frmMember24">
<form action="" method="POST" onsubmit="return checkMemberForm24
(this)">
<div style="padding:5px;font-weight:bold;">Member Information</div>
<div class="formLine">
<div class="formSpace"><u>Please enter your Information</u></div>
</div>
<div style="clear:both;height:0px;">
<input type="hidden" name="ow" value="ProcessMember"/>
</div>
<div class="formLine">
<div class="formCaption">First Name :</div>
<div class="formControl">
<input type="text" class="formControlText" name="form[first_name]"
value="John"/>
</div>
</div>
<div class="formLine">
<div class="formCaption">Last Name :</div>
<div class="formControl">
<input type="text" class="formControlText" name="form[last_name]"
value="Doe"/>
</div>
</div>
<div class="formLine">
<div class="formCaption">Sex :</div>
<div class="formControl">
<select name="form[sex]" value=""/>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
</div>
<div class="formLine">
<div class="formCaption">Age :</div>
<div class="formControl">
<input type="text" class="formControlText" style="width:50px;"
maxlength="4" size="2" name="form[age]" value="35"/>
</div>
</div>
<br/>
<div class="formLine">
<div class="formSpace" style="text-align:center;width:100%;">
<input type="image" src="images/buttons/submit.gif" alt="Submit >>"
id="submit"/>
<br/>
</div>
</div>
</form>
</div>
</div>
i was try this
document.cookie='firstname='+document.getElementById('form
[first_name]').value;
document.cookie='firstname='+document.forms['form[first_name]'].value;
document.cookie='firstname='+document.forms.frm.elements['form
[first_name]'].value;
document.cookie='firstname='+document.forms.[frmMember24].elements
['form[first_name]'].value;
document.cookie='firstname='+document.forms.[formControlText].elements
['form[first_name]'].value;
and etc
but all i type still undefined.
can someone explaint it to me how to get it?
thanks
i`m new in javascript...
i got crazy with this script because i was search in many tutorial and
learn online and do "try and error"
for 2 weeks to get variable value but still undefined
how i can get cookies all value without changing this script with
document.cookie?
<script language="javascript" type="text/javascript"><!--
function checkMemberForm24(frm){
if(!validateName(frm.elements['form[first_name]'].value)){
alert('Please enter valid First Name!');
frm.elements['form[first_name]'].focus();
return false;
}
if(!validateName(frm.elements['form[last_name]'].value)){
alert('Please enter valid Last Name!');
frm.elements['form[last_name]'].focus();
return false;
}
if((frm.elements['form[sex]'].value == 'Yes') && (frm.elements['form
[age]'].value == '')){
alert('Age and sex Required!');
frm.elements['form[age]'].focus();
return false;
}
--></script>
<div id="divForm24" class="formContent" id="frmMember24"
name="frmMember24">
<form action="" method="POST" onsubmit="return checkMemberForm24
(this)">
<div style="padding:5px;font-weight:bold;">Member Information</div>
<div class="formLine">
<div class="formSpace"><u>Please enter your Information</u></div>
</div>
<div style="clear:both;height:0px;">
<input type="hidden" name="ow" value="ProcessMember"/>
</div>
<div class="formLine">
<div class="formCaption">First Name :</div>
<div class="formControl">
<input type="text" class="formControlText" name="form[first_name]"
value="John"/>
</div>
</div>
<div class="formLine">
<div class="formCaption">Last Name :</div>
<div class="formControl">
<input type="text" class="formControlText" name="form[last_name]"
value="Doe"/>
</div>
</div>
<div class="formLine">
<div class="formCaption">Sex :</div>
<div class="formControl">
<select name="form[sex]" value=""/>
<option value="Male">Male</option>
<option value="Female">Female</option>
</select>
</div>
</div>
<div class="formLine">
<div class="formCaption">Age :</div>
<div class="formControl">
<input type="text" class="formControlText" style="width:50px;"
maxlength="4" size="2" name="form[age]" value="35"/>
</div>
</div>
<br/>
<div class="formLine">
<div class="formSpace" style="text-align:center;width:100%;">
<input type="image" src="images/buttons/submit.gif" alt="Submit >>"
id="submit"/>
<br/>
</div>
</div>
</form>
</div>
</div>
i was try this
document.cookie='firstname='+document.getElementById('form
[first_name]').value;
document.cookie='firstname='+document.forms['form[first_name]'].value;
document.cookie='firstname='+document.forms.frm.elements['form
[first_name]'].value;
document.cookie='firstname='+document.forms.[frmMember24].elements
['form[first_name]'].value;
document.cookie='firstname='+document.forms.[formControlText].elements
['form[first_name]'].value;
and etc
but all i type still undefined.
can someone explaint it to me how to get it?
thanks