...

View Full Version : Help!



AKadmin
03-10-2009, 08:42 PM
This form and script have to be on the same page becasue the form was not setup to be by itself... I think parts of the J.script need to go into the Form? Can anyone tell me how to separate the script from the form?

<html>
<head>
<title>ComboBox[4]</title>
</head>
<body>

<FORM name="CBN">
<table border="0" cellspacing="0" cellpadding="0" style="font-family: Lucida Console,Verdana, Tahoma, Arial; font-size: 9">
<tr align="center">
<td nowrap height="11"> &nbsp;
<select name="CBN1" size="1" style="font-family: Lucida Console,Verdana, Tahoma, Arial; font-size: 9"
onChange="ReDirect1(this.options.selectedIndex)">
<option selected>---Select1-------------</option>
<option>1</option>
<option>2</option>
</select>
<select name="CBN2" size="1" style="font-family: Lucida Console,Verdana, Tahoma, Arial; font-size: 9"
onChange="ReDirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select2--------------</option>
<option value=" " selected>---Select2--------------</option>
</select>
<select name="CBN3" size="1" style="font-family: Lucida Console,Verdana, Tahoma, Arial; font-size: 9"
onChange="ReDirect3(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select3----------------</option>
<option value=" " selected>---Select3----------------</option>
</select>
<select name="CBN4" size="1" style="font-family: Lucida Console,Verdana, Tahoma, Arial; font-size: 9"
onChange="ReDirect(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select4----------------</option>
<option value=" " selected>---Select4----------------</option>
</select>
<script>
<!--

/* */
var temp=document.CBN.CBN2
var temp1=document.CBN.CBN3
var temp2=document.CBN.CBN4
var CB2=document.CBN.CBN1.options.length
var CB3=document.CBN.CBN2.options.length
var CB4=document.CBN.CBN3.options.length
var ComboBox2=new Array(CB2)
var ComboBox3=new Array(CB2)
var ComboBox4=new Array(CB2)

var maximum="12"
var max=eval(maximum-1)
/* */

for (a=0; a<=max; a++){
ComboBox2[a]=new Array()
}
for (b=0; b<=max; b++){
ComboBox3[b]=new Array()
for (c=0; c<=max; c++){
ComboBox3[b][c]=new Array()
}}
for (d=0; d<=max; d++){
ComboBox4[d]=new Array()
for (e=0; e<=max; e++){
ComboBox4[d][e]=new Array()
for (f=0;f<=max; f++){
ComboBox4[d][e][f]=new Array()
}}}

ComboBox2[0][0]=new Option("---Select2---"," ");
ComboBox2[1][0]=new Option("Now Select This One"," ");
ComboBox2[1][1]=new Option("1.1","");
ComboBox2[1][2]=new Option("1.2","");
ComboBox2[2][0]=new Option("Now Select This One"," ");
ComboBox2[2][1]=new Option("2.1","");
ComboBox2[2][2]=new Option("2.2","");
ComboBox3[0][0][0]=new Option("---Select 3---"," ");
ComboBox3[1][0][0]=new Option("---Select 3---"," ");
ComboBox3[1][1][0]=new Option("Now Select This One"," ");
ComboBox3[1][1][1]=new Option("1.1.1","");
ComboBox3[1][1][2]=new Option("1.1.2","");
ComboBox3[1][2][0]=new Option("Now Select This One"," ");
ComboBox3[1][2][1]=new Option("1.2.1","");
ComboBox3[1][2][2]=new Option("1.2.2","");
ComboBox3[2][0][0]=new Option("---Select 3---"," ");
ComboBox3[2][1][0]=new Option("Now Select This One"," ");
ComboBox3[2][1][1]=new Option("2.1.1","");
ComboBox3[2][1][2]=new Option("2.1.2","");
ComboBox3[2][2][0]=new Option("Now Select This One"," ");
ComboBox3[2][2][1]=new Option("2.2.1","");
ComboBox3[2][2][2]=new Option("2.2.2","");
ComboBox4[0][0][0][0]=new Option("---Select 4---"," ");
ComboBox4[1][0][0][0]=new Option("---Select 4---"," ");
ComboBox4[1][1][1][0]=new Option("Now Select A Page"," ");
ComboBox4[1][1][1][1]=new Option("1.1.1.1","http://www..com");
ComboBox4[1][1][1][2]=new Option("1.1.1.2","http://www..com");
ComboBox4[1][1][2][0]=new Option("Now Select A Page"," ");
ComboBox4[1][1][2][1]=new Option("1.1.2.1","http://www..com");
ComboBox4[1][1][2][2]=new Option("1.1.2.2","http://www..com");
ComboBox4[1][2][1][0]=new Option("Now Select A Page"," ");
ComboBox4[1][2][1][1]=new Option("1.2.1.1","http://www..com");
ComboBox4[1][2][1][2]=new Option("1.2.1.2","http://www..com");
ComboBox4[1][2][2][0]=new Option("Now Select A Page"," ");
ComboBox4[1][2][2][1]=new Option("1.2.2.1","http://www..com");
ComboBox4[1][2][2][2]=new Option("1.2.2.2","http://www..com");
ComboBox4[2][0][0][0]=new Option("---Select 4---"," ");
ComboBox4[2][1][1][0]=new Option("Now Select A Page"," ");
ComboBox4[2][1][1][1]=new Option("2.1.1.1","http://www..com");
ComboBox4[2][1][1][2]=new Option("2.1.1.2","http://www..com");
ComboBox4[2][1][2][0]=new Option("Now Select A Page"," ");
ComboBox4[2][1][2][1]=new Option("2.1.2.1","http://www..com");
ComboBox4[2][1][2][2]=new Option("2.1.2.2","http://www..com");
ComboBox4[2][2][1][0]=new Option("Now Select A Page"," ");
ComboBox4[2][2][1][1]=new Option("2.2.1.1","http://www..com");
ComboBox4[2][2][1][2]=new Option("2.2.1.2","http://www..com");
ComboBox4[2][2][2][0]=new Option("Now Select A Page"," ");
ComboBox4[2][2][2][1]=new Option("2.2.2.1","http://www..com");
ComboBox4[2][2][2][2]=new Option("2.2.2.2","http://www..com");


/* */
function ReDirect1(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<ComboBox2[x].length;i++){
temp.options[i]=new Option(ComboBox2[x][i].text,ComboBox2[x][i].value)
}
temp.options[0].selected=true
ReDirect2(0)
}
function ReDirect2(y){
var x=document.CBN.CBN1.options.selectedIndex
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<ComboBox3[x][y].length;i++){
temp1.options[i]=new Option(ComboBox3[x][y][i].text,ComboBox3[x][y][i].value)
}
temp1.options[0].selected=true
ReDirect3(0)
}
function ReDirect3(z){
var x=document.CBN.CBN1.options.selectedIndex
var y=document.CBN.CBN2.options.selectedIndex
for (m=temp2.options.length-1;m>0;m--)
temp2.options[m]=null
for (i=0;i<ComboBox4[x][y][z].length;i++){
temp2.options[i]=new Option(ComboBox4[x][y][z][i].text,ComboBox4[x][y][z][i].value)
}
temp2.options[0].selected=true
}
function ReDirect(z){
window.location=temp2[z].value
}
//-->
</script>

</td>
</tr>
</table>
</FORM>

Philip M
03-10-2009, 08:59 PM
The script begins with <script> which should read <script type = "text/javascript"> and ends with </script>.

Suggest you move these lines:-

</td> // this line is not required
</tr> // this line is not required
</table>
</FORM>

to after this:-

<select name="CBN4" size="1" style="font-family: Lucida Console,Verdana, Tahoma, Arial; font-size: 9"
onChange="ReDirect(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select4----------------</option>
<option value=" " selected>---Select4----------------</option>
</select>


But the HTML appears to be incomplete.


Do please read the posting guidelines regarding silly thread titles. The thread title is supposed to help people who have a similar problem in future. Yours is useless for this purpose.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum