If Statements and SelectIndex

G

Gregc.

Hi

I am trying work out a If statment, that uses a select statement as its
condition. In index.html I have the following:

function selectCar(){
var cars = ["Holden","Ford","Mercedes"]
var theSel = top.topFrame.document.fmCar.selectCar;
var opt = theSel.options;
for(i=0;i<cars.length;i++){
var carVal = cars;
opt = new Option(carVal, carVal)
}
theSel.selectedIndex = Math.floor(Math.random()*cars.length);
}
function showSelect(){
var i=0;
var Holden = new Array (3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6,
14.2, 10.3, 6.6, 4.8)
var Ford = new Array (3.5, 4.9, 6.9, 10.4, 13.6, 17.3, 18.7, 18.1,
16.2, 16.2, 12.3, 7.2, 3.5)
var Mereceds = new Array(7.2, 8.3, 10.5, 13.7, 17.8, 21.7, 24.4,
24.1, 20.9, 16.6, 11.7, 8.4, 15.4)
var j = main1.mainframe.document.
=>Want I want here is to happen is that if the operator selects say
'Holden' it updates the table on main1.html<=


</script>
</head>

<frameset rows="100,*" frameborder="no" border="0" framespacing="0">
<frame src="topCar.html" name="topFrame" scrolling="No"
noresize="noresize" marginwidth="0" marginheight="0" id="topFrame" />
<frame src="main1.html" name="mainFrame" scrolling="No" marginwidth="0"
marginheight="0" id="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>


main1.html looks like
<tr>
<td class="borderR">&nbsp;</td>

<td class="borderBR"><p align="right">3.5 </p></td>
<td class="borderBR"><p align="right">4.9 </p></td>
<td class="borderBR"><p align="right">6.9 </p></td>
<td class="borderBR"><p align="right">10.4 </p></td>
<td class="borderBR"><p align="right">13.6 </p></td>
<td class="borderBR"><p align="right">17.3 </p></td>
<td class="borderBR"><p align="right">18.7 </p></td>
<td class="borderBR"><p align="right">18.1 </p></td>
<td class="borderBR"><p align="right">16.2 </p></td>
<td class="borderBR"><p align="right">12.3 </p></td>
<td class="borderBR"><p align="right">7.2 </p></td>
<td class="borderBR"><p align="right">3.5 </p></td>
</tr>
</table>
Could someon advice me on how to achieve this.

Greg
 
J

Jake Barnes

Gregc. said:
Hi

I am trying work out a If statment, that uses a select statement as its
condition. In index.html I have the following:

function selectCar(){
var cars = ["Holden","Ford","Mercedes"]
var theSel = top.topFrame.document.fmCar.selectCar;
var opt = theSel.options;
for(i=0;i<cars.length;i++){
var carVal = cars;
opt = new Option(carVal, carVal)
}
theSel.selectedIndex = Math.floor(Math.random()*cars.length);
}
function showSelect(){
var i=0;
var Holden = new Array (3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6,
14.2, 10.3, 6.6, 4.8)
var Ford = new Array (3.5, 4.9, 6.9, 10.4, 13.6, 17.3, 18.7, 18.1,
16.2, 16.2, 12.3, 7.2, 3.5)
var Mereceds = new Array(7.2, 8.3, 10.5, 13.7, 17.8, 21.7, 24.4,
24.1, 20.9, 16.6, 11.7, 8.4, 15.4)
var j = main1.mainframe.document.
=>Want I want here is to happen is that if the operator selects say
'Holden' it updates the table on main1.html<=


</script>
</head>

<frameset rows="100,*" frameborder="no" border="0" framespacing="0">
<frame src="topCar.html" name="topFrame" scrolling="No"
noresize="noresize" marginwidth="0" marginheight="0" id="topFrame" />
<frame src="main1.html" name="mainFrame" scrolling="No" marginwidth="0"
marginheight="0" id="mainFrame" />
</frameset>
<noframes><body>
</body>
</noframes></html>



Could you point us to the actual page? A URL? I was going to recreate
this, but with the frames it seems like a lot of work to recreate. What
are you hoping to achieve by using frames, anyway?
 
G

Gregc.

Jake said:
Could you point us to the actual page? A URL? I was going to recreate
this, but with the frames it seems like a lot of work to recreate. What
are you hoping to achieve by using frames, anyway?


I've nearly worked it out. Can't understand what's the big deal with
frames.

Greg
 

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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top