|
 |
javascript thread: Problem printing function result
Message #1 by "Rolando Garro Mena" <rolando@n...> on Wed, 12 Sep 2001 18:36:28 -0600
|
|
First of all, it's supposed to be:
<select name="country" onChange="Pais()"> // Notice the parentheses after
the function name
not:
<select name="country" onChange="Pais">
Second of all, to be cross-browser compatible, the function should look like
this:
function Pais(){
var p
document.form1.coutry.options[document.form1.country.selectedIndex].value;
return p;
}
/Robert
-----Original Message-----
From: Rolando Garro Mena [mailto:rolando@n...]
Sent: den 13 september 2001 02:36
To: javascript
Subject: [javascript] Problem printing function result
Im trying to create a dinamic link somenting like test.php?pais=(i want to
put here the result of this function)
function Pais(){
var p = document.form1.coutry.value;
return p;
}
where "country" is a listmenu, ive been trying for hours and havent work
Here is te small code ive been trying with no results, can somebody help me?
Thanks a Lot
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript">
<!--
function Pais(){
var p = document.form1.coutry.value;
return p;
}
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="Pais()">
<p><a
href="test.php?nombre=rolando&email=rolando@n...&pais="+javascript:
Pais();" """>mandar</a>
</p>
<form name="form1" method="post" action="">
<select name="country" onChange="Pais">
<option value="usa">USA</option>
<option value="spain">Spain</option>
<option value="uk">UK</option>
</select>
</form>
<p> </p>
</body>
</html>
|
|
 |