[Javascript] passing values in a link

Varsou Nilsa nvarsou at infoserve.gr
Mon May 14 09:10:25 CDT 2001


Hi everyone, I need some help, I am trying to pass a key value in a href
link, I have done this before and I just don't get why is not working,
the truth is I am a begginer in jscript, bellow I have my code, when I
click the "take me there" link to de default.htm page I want to pass a
key with the value of the T1.field on it, instead of this the link take
me to the default page with a null key something like default.htm?key=,
yet when I put a default value to the key (something like
href="default.htm?key=" + 4) the result is still the same, what am I
doing rong?
TIA

<form name="myform" method="Get">
  <p><input type="text" name="T1" size="20">
  <p><input type="text" name="T2" size="20">
   <p>
   <input type="radio" name="showView" id=showView value="0"><label
for="showAll" id="label1">
      Show all </label>
        </p>
  <p>
   <input type="radio" name="showView" id=showView value="1"
checked><label for="showFiltered " id="label2">
      Filter </label>
        </p>       
</form>
<script language="javascript">
function validate(){
	if(document.myform.showView(0).checked){
	document.myform.T1.value == "";
	document.myform.T2.value == "";
	}

	if(document.myform.showView(1).checked){
		if(document.myform.T1.value == "" &&
document.myform.T2.value == ""){
		alert("Sorry, you must fill at least one of the
fields.");
		return false;
		}
	document.myform.submit();	
 	}
}

</script>

<p><a href="default.htm?key=" + document.myform.T1.value onClick="return
validate()">take me there</a></p>






Nilza Da Silva Varsou
Web Developer

INFOSERVE SA
145 Vizantiou str.
GR 142 35, Kalogreza
Athens, Greece
Tel. +30-1-2595300
Fax +30-1-2595301
-------------------------------
www.infoactivity.com
eCRM application
-------------------------------





More information about the Javascript mailing list