Please help -- How to run script several times within one document

T

ThunStorm

Please help!!! I have a script that I am able to run one time. After
adding a second phase to run the script the script bugs out. How can I
get the script to run several times and pull the same data?

Here is what I am using:

<head>
<title>Untitled</title>
<style type="text/css">
..dropcontent{
width: 300px;
height: 140px;
display:block;
}
</style>

<script type="text/javascript">

if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.dropcontent{display:none;}\n')
document.write('</style>\n')
}

function contractall(){
if (document.getElementById){
var inc=0
while (document.getElementById("dropmsg"+inc)){
document.getElementById("dropmsg"+inc).style.display="none"
inc++
}
}
}

function expandone(){
if (document.getElementById){
var selectedItem=document.dropmsgform.dropmsgoption.selectedIndex
contractall()
document.getElementById("dropmsg"+selectedItem).style.display="block"
}
}

if (window.addEventListener)
window.addEventListener("load", expandone, false)
else if (window.attachEvent)
window.attachEvent("onload", expandone)

</script>
================
Here is the body:
<form name="dropmsgform">

<select name="dropmsgoption" size="1" style="width:175"
onChange="expandone()">
<OPTION>Select Team
<OPTION>#1 Lucky Strikes
<OPTION>#2 Morn-D-Lites
<OPTION>#3 Pin-Up's
<OPTION>#4 Pin Pals
<OPTION>#5 Dreamers
<OPTION>#6 Ups + Downs
<OPTION>#7 Alley Cats
<OPTION>#8 Blind
</SELECT>
&nbsp; &nbsp;&nbsp;
<INPUT TYPE=text NAME=ihg1 SIZE=2 MAXLENGTH=4>

<div id="dropmsg0" class="dropcontent">
???
</div>

<div id="dropmsg1" class="dropcontent">
Karen L.
<br>
Marlene T.
<br>
Joyce A.
<br>
Mickey Z.
</div>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top