-
<html>
-
<head>
-
<title>Untitled Document</title>
-
<script type="text/javascript">
-
function ikel()
-
{
-
var sel = document.ikki.sel.value;
-
-
if(sel=="T-shirt")
-
{
-
var shirt = ["bench","cotton republic"];
-
var shirt_len=shirt.length;
-
var el=0;
-
for(var ii=0; ii<shirt_len; ii++)
-
{
-
document.ikki.brand.options[ii]=new Option(shirt[ii], ii);
-
}
-
return sel;
-
}//end of if satatement T-shirt
-
-
if(sel=="CARS")
-
{
-
var car = ["Toyota","Honda", "Forbes", "Mitsubishi", "Kia", "Nissan"];
-
var car_len=car.length;
-
var cc=0;
-
for(var cc=0; cc<car_len; cc++)
-
{
-
document.ikki.brand.options[cc]=new Option(car[cc], cc);
-
}
-
return sel;
-
}//end of if satatement Cars
-
-
if(sel=="Porn Site")
-
{
-
var por = ["Mofos.com","Naughty America.com", "Erotica.com"];
-
var por_len=por.length;
-
var xx=0;
-
for(var xx=0; xx<por_len; xx++)
-
{
-
document.ikki.brand.options[xx]=new Option(por[xx], xx);
-
}
-
return sel;
-
}//end of if satatement Cars
-
-
}//end of function ikel
-
window.onload=ikel;
-
</script>
-
</head>
-
<body>
-
<form name="ikki">
-
Menu
-
<select name="sel" onclick="ikel()" id="selected" >
-
<option >T-shirt</option>
-
<option >CARS</option>
-
<option >Porn Site</option>
-
</select>
-
Brand
-
<select name="brand" onchange="ikel()" ><!--option output--></select>
-
</form>
-
</body>
-
</html>
My problem here is that some values in longest array variable (like CARS for select tag Menu) adopted by the select tag (like the select tag for T-shirt in brand menu). Please response...
you can run the code and please observe...
4 1866
just use the following line to remove all the previous options in the select tag before all for loop those binds new data to 2nd combo box: -
document.ikki.brand.options.length=0;
-
thank you for that code . . . your great . . . hehe... I'm just a beginner in javascript... thank you very much... see you for my ext questions.... haha god bless.. :)
I have A question... How can I select the content of brand here...Example : when I selected in the Menu like for Example CARS, the Options will display in "Brand", but when I started to select the 2nd to the last option, the only value that appears is the first value like "Toyota"...
in your HTML you have line like following: -
<select name="brand" onchange="ikel()" ><!--option output--></select>
here, "onchange" Event creates the problem for you. when ever you click an item in "sel" select tag the values of "brand" select change because of "ikel()" function in "sel"'s "onclick" event.
similarly, whenever you select an option from "brand" item, it calls the "ikel()" function that used in "onchange" Event of "brand".
So, remove the 'onchange="ikel ()"' from the "brand" select tag.
Hope you understand. :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: dr. zoidberg |
last post by:
Is it possible to put Variable in Array? Here is what I need:
$array = Array($a,$b);
$a = 'something';
$b = 'something else';
foreach ($array as $val) {
echo "$val";
}
|
by: Xiangliang Meng |
last post by:
Hi.
void setValue(int n)
{
int size = getValueLength();
int buffer_p;
if (buffer_p)
{
....
|
by: Wolfram Heinz |
last post by:
Hi there,
How can I avoid type-conversion (object variable --> string) when
passing an object variable to a function?
Example:
-->
catch(myerrorobject)
alert(myerrorobject.filename);
{
my_function('bla: ',myerrorobject);
|
by: dam_fool_2003 |
last post by:
Hai,
I studied that the array size is fixed. But I come across a word
called "variable length array". Is it possible to change the array
size? So I tried the following:
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
int y = { 7, 9,10},i;
for (;i<20;i++)
|
by: Adam Warner |
last post by:
Hi all,
With this structure that records the length of an array of pointers as its
first member:
struct array {
ptrdiff_t length;
void *ptr;
};
| |
by: Fernando Barsoba |
last post by:
Hi,
I decided to start a new topic about my memory allocation question. One
of the answers was that variable length arrays are possible using C99. I
found this topic that also mentions it.
http://groups.google.com/group/comp.lang.c/browse_frm/thread/f7285cf1ffb172c3/f5335d22d6e6fb34?q=variable+length+array&rnum=2#f5335d22d6e6fb34
I did some test, but I get strange results:
|
by: moonriver |
last post by:
I intend to generate a variable-length array, similar to link lists in plain C. For example, I define the following array
int a
Initially I assign 5 elements to the array as
a = new int
for( k = 0; k < 5; k++
a = k
|
by: lovecreatesbeauty |
last post by:
Hello experts,
I have seen following the code snippet given by Marc Boyer (with slight
changes by me for a better format), and have doubts on it. I am so
grateful if you can give me your kindly help and hints on this problem.
1. Does the function call `foo(3, 3, tab);' refer to the data outside
the array `int tab;'. The available subscription for a 3X3 2-D array
should be 0..2 X 0..2, I think.
|
by: Mrozu |
last post by:
Hi
How can I include in name of my variable value of other variable? I
have following code:
For x = 0 To 10
Dim column As New DataGridTextBoxColumn
column.MappingName = magazyny(x)
|
by: Dan |
last post by:
Excuse me if i'm being a bit thick here, but is it possible to
reference a server side variable within an embedded js source file.
For example, my test.js file contains
alert('<%=tmpVar%>');
and my aspx page contains:-
<script type="text/javascript" src="test.js">
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |