Hi chaps,
Im trying to write a javascript event(or atleast i think thats whats im doing)
Here’s the xhtml:
<div class=”contentleft”>
<form method=”post” action=””>
<p>How many friends would you like to invite?</p>
<select >
<option style=”background-color: #800000″ value=”1″>1</option>
<option style=”background-color: #800000″ onclick=”function” value=”2″>2</option>
<option style=”background-color: #800000″ value=”3″>3</option>
<option style=”background-color: #800000″ value=”4″>4</option>
<option style=”background-color: #800000″ value=”5″>5</option>
<option style=”background-color: #800000″ value=”6″>6</option>
<option style=”background-color: #800000″ value=”7″>7</option>
<option style=”background-color: #800000″ value=”8″>8</option>
<option style=”background-color: #800000″ value=”9″>9</option>
<option style=”background-color: #800000″ value=”10″>10</option>
<option style=”background-color: #800000″ value=”11″>11</option>
<option style=”background-color: #800000″ value=”12″>12</option>
<option style=”background-color: #800000″ value=”13″>13</option>
<option style=”background-color: #800000″ value=”14″>14</option>
<option style=”background-color: #800000″ value=”15″>15</option>
</select>
<input type=”text” style=”background-color: #800000″ value=”Email address” />
<select>
<option style=”background-color: #800000″ value=”hotmail.co.uk”>hotmail.co.uk</option>
<option style=”background-color: #800000″ value=”hotmail.com”>hotmail.com</option>
<option style=”background-color: #800000″ value=”yahoo.co.uk”>Yahoo.co.uk</option>
<option style=”background-color: #800000″ value=”yahoo.com”>Yahoo.com</option>
<option style=”background-color: #800000″ value=”gmail.co.uk”>Gmail.co.uk</option>
<option style=”background-color: #800000″ value=”gmail.com”>Gmail.com</option>
</select>
What the script has to do is create another email field and drop down box, this will occure when the user select ‘2’ or more from the drop down list i.e user selects 3 and 2 additional fields will appear.
Im told i need to use an ‘event handler’ problem is i dont know what an event handler is! below is what i have so far, also i dont want the code completed for me i just want somewhere to start from.
Ive started with;
<script type=”text/javascript”>
function newField(){<–am i on the right lines here?
What do i start with here?
}
</script>