473,480 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

If Statements and SelectIndex

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[i];
opt[i] = 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

Sep 18 '06 #1
2 1481

Gregc. wrote:
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[i];
opt[i] = 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?

Sep 18 '06 #2

Jake Barnes wrote:
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

Sep 19 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1084
by: | last post by:
Hello All, Simple question, how do you tell the DataGrid.selectIndex to return the value in column 2?
1
3787
by: Tom D | last post by:
I'm rewriting a database interface that our company currently has. Currently it's using the Pear::DB interface, but we found that that was introducing a bit too much overhead. I'm rewriting the...
39
6787
by: slogging_away | last post by:
Hi - I'm running Python 2.4.2 (#67, Sep 28 2005, 12:41:11) on win32, and have a script that makes numerous checks on text files, (configuration files), so discrepancies can be reported. The script...
0
1831
by: Fuzzyman | last post by:
Hello all, The following is a copy of a blog entry. It's asking a question about future statements and the built in compile function. I'd appreciate any pointers or comments about possible...
20
1988
by: Neroku | last post by:
Hello, i would like to know what the serious definition of statements and expressions is: i know an expression are evaluated to a value, i.e: 1 == 2 5+7 foo( 1,2) and a statement is...
2
2710
by: ojorus | last post by:
Hi! Some questions regarding the mysqli-extension (php5) 1) Prepared statements: If I understand things right, prepared statements will give better performance if you make several similar...
2
1157
by: barry | last post by:
I am using the animation extender in asp.net ajax and have a RadioButtonList in a div and access it in javascript through the extender. The object passed into the javascript function is...
3
6584
by: Dmitri | last post by:
Hello! I have a developer that is playing around with some SQL statements using VB.NET. He has a test table in a SQL 2000 database, and he has about 2000 generated INSERT statements. When the...
0
1899
by: Gary Herron | last post by:
Ohad Frand wrote: There is no way you can consider 'elif', 'else', 'except', and 'from' statements. However, as someone pointed out, the kwlist from the keyword module is the closest thing we...
0
1432
by: Ohad Frand | last post by:
Hi Thanks a lot for your reply I think the main uses for it is to study the language and to see that I didn't miss anything else or that something is changed from one version to another. The...
0
7044
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6908
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7045
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6741
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4483
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2995
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2985
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.