Connecting Tech Pros Worldwide Help | Site Map

Use the same java script several different times in one document in a table

 
LinkBack Thread Tools Search this Thread
  #1  
Old February 10th, 2006, 04:55 PM
moda7884@hotmail.com
Guest
 
Posts: n/a
Default Use the same java script several different times in one document in a table

I am a beginner and trying to figure this out? How can I get another
version of the javascript to appear in another table cell using the
same script? I have to use the same script 8 different times with the
same team names? Thank you in advance.

Here is the code:
<html>
<head>
<title>Untitled</title>
<style type="text/css">
..dropcontent{
width: 300px;
height: 140px;
background-color: #fa006b;
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.displ ay="none"
inc++
}
}
}

function expandone(){
if (document.getElementById){
var selectedItem=document.dropmsgform.dropmsgoption.se lectedIndex
contractall()
document.getElementById("dropmsg"+selectedItem).st yle.display="block"
}
}

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

</script>
</head>

<body>
<Table border="1">
<tr>

<td>
<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>

<div id="dropmsg2" class="dropcontent">
Joan T.
<br>
June G.
<br>
Alice G.
<br>
Sandy B.
</div>

<div id="dropmsg3" class="dropcontent">
Mary B.
<br>
Amy S.
<br>
Carol C.
<br>
Dee V.
</div>

<div id="dropmsg4" class="dropcontent">
Bev W.
<br>
Fran D.
<br>
Barb F.
<br>
Gerry B.
</div>

<div id="dropmsg5" class="dropcontent">
Blind
<br>
Lynda F.
<br>
Gail J.
<br>
Val B.
</div>

<div id="dropmsg6" class="dropcontent">
Helen N.
<br>
Sandy S.
<br>
Pat D.
<br>
Blind
</div>

<div id="dropmsg7" class="dropcontent" >
Dora F.
<br>
Yo P.
<br>
Minnie C.
<br>
Blind
</div>

<div id="dropmsg8" class="dropcontent" div align="center">
You Must Bowl NO <br>
LESS THAN ( <INPUT TYPE=text NAME=PPG SIZE=2 MAXLENGTH=3> ) To <br>
Take A Point Per Game!!!
</div>

</form>
</td>

<td>
<form name="dropmsgform1">
<select name="dropmsgoption1" size="1" style="width:275"
onChange="expandone()">
<option selected>JavaScript?</option>
<option>Java</option>
<option>DHTML</option>
</select>
<br>

<div id="dropmsg0" class="dropcontent">
JavaScript is cool.
</div>

<div id="dropmsg1" class="dropcontent">
Html rocks.
</div>

<div id="dropmsg2" class="dropcontent">
DHTML is awesome.
</div>
</form>
</td>

</tr>
</table>
</body>
</html>


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.