|
|
#1 |
|
Baseband Member
Join Date: Sep 2008
Posts: 60
|
Hello
I want a code in javascript with the form below: - a select form allow the visitor to chose a topic - a box under the select form show explaining about the selected topic I want another script that forces the visitor to insert 15 numbers in the text field Thank you very much
__________________
SAY NO TO PIRACY |
|
|
|
|
|
#2 |
|
Solid State Member
Join Date: Sep 2009
Posts: 13
|
Search in google for Dynamic Drive(first place), you will find a website with a great collections of javascript. The second script you request it's there.
|
|
|
|
|
|
#3 |
|
In Runtime
|
Here is something I typed up real fast.
In the <head> section of your page Code:
<script type="text/javascript">
<!--
var descriptions = new Array(5);
descriptions[0] = "Description 1";
descriptions[1] = "Description 2";
descriptions[2] = "Description 3";
descriptions[3] = "Description 4";
descriptions[4] = "Description 5";
function listChanged(obj) {
var curIndex = obj.selectedIndex;
var curValue = obj.options[curIndex].value;
if(Number(curValue).toString() != 'NaN' || Number(curValue) < 0) { // make sure it's a valid number
document.getElementById('output').innerHTML = descriptions[curValue];
} else {
document.getElementById('output').innerHTML = "Please select an item to view it's description.";
} // end if/else
} // end function
//-->
</script>
Code:
<select id="itemSelection" name="itemSelection" onchange="listChanged(this);"> <option value="-1" selected>--Select--</option> <option value="0">First Item</option> <option value="1">Second Item</option> <option value="2">Third Item</option> <option value="3">Fourth Item</option> <option value="4">Fifth Item</option> </select> </form> <div id="output"> Please select an item to view it's description. </div> You can change the text for each of the descriptions and this will be updated when they change options. If you can provide a little more information about what you're trying to do, I can help with the second script also.
__________________
**Official Self-proclaimed glorified excessive (insert additional adjectives here) post editor/modifier. Edit = Best feature ever http://www.twitter.com/xDaevax |
|
|
|
|
|
#4 |
|
Baseband Member
Join Date: Sep 2008
Posts: 60
|
Hi
Mr. perseadrian The web site Dynamic Drive is a really library for web scripts Thank you Mr. Daeva Your script is 100% ok Thanks alot
__________________
SAY NO TO PIRACY |
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|