Q
question.boy
This is a begginner question, but I need to pass 1 or more value to a
javascript function from an onclick event on my form, could someone
help me get a functional example.
For my learning purposes, the example is quite simple. I would like
to have one button return a alert window for one passed value and
another button (using the same function) return 2 passed values. I'm
looking for a function that can handle single and multiple passed
variables.
<!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=iso-8859-1" />
<script language="javascript">
var aCtls = New Array();
function AlCtls(aCtls){
for (i=0;aCtls.length;i++) {
alert aCtls;
}
}
</script>
</head>
<body>
onclick="AlCtls('1,2')"/>
</form>
</body>
</html>
Thank you for the help!
QB
javascript function from an onclick event on my form, could someone
help me get a functional example.
For my learning purposes, the example is quite simple. I would like
to have one button return a alert window for one passed value and
another button (using the same function) return 2 passed values. I'm
looking for a function that can handle single and multiple passed
variables.
<!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=iso-8859-1" />
<script language="javascript">
var aCtls = New Array();
function AlCtls(aCtls){
for (i=0;aCtls.length;i++) {
alert aCtls;
}
}
</script>
</head>
<body>
<input id="btn2" type="button" value="Submit"<br/>
onclick="AlCtls('1,2')"/>
</form>
</body>
</html>
Thank you for the help!
QB