0

This is my codes

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript" src="js/mootools.js"></script>
<script language="javascript" type="text/javascript" src="js/getchqno.js"></script>
</head>

<body>
<script type="text/javascript">
function buildSelect(select, options)
{
    var select = $(select);
    select.empty();
    options.each(function(item) {
        if($type(item) != "array")
        {
            item = [item, item];
            var option = new Element("option", {
                text: item[0].toString(),
                value: item[1].toString()
            });
            option.inject(select);
        }
    });
}

function domready()
{
    $('master').addEvent('change', master_changed);
}

function master_changed()

{
	
    var req = new Request.JSON({
        url: 'getowner.php',
        method: 'post',
        data: 'id=' + encodeURIComponent($('master').get('value'))
    });
    req.addEvent('success', function(response) {
        buildSelect('slave', response);
    });
    req.send();
}

window.addEvent('domready', domready);
</script>
<form action="" method="post" name="F21" id="F21">
  <p>Make
    <select name="make" id="master">
      <option selected="selected" >d1</option>
      <?php
   include("init/db.php");
       $sql="SELECT *
FROM `customers`";
		
		$result=mysql_query($sql);
		while ($info=mysql_fetch_array($result)){
			$id= $info['id'];
			$name = $info['fname']." ".$info['lname'];
			echo '<option value="'.$id.'">'.$name.'</option>';
			}		
		
		?>
    </select>
  </p>
  <p>Model
    <select name="model" id="slave">
      <option>SELECT</option>
    </select>
  </p>
</form>
</body>
</html>

if i added this two files to this files my codes are not working

<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src=".../js/jquery.min.js"></script>

can any one help me to solve this problem i am a new one in JS

2
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by ruwanaru
0

Did you check where you copied the files. Maybe they are in a different folder then you specified.

yes i checked that their is no error in their

0

What is it supposed to do, and is it possible to see it somewhere in action online ?

im sorry about that what i want is when i select a value in a select (list/menu)
i want to get from relevant data to a another select (list/menu)

but i used this codes in a another place that is working if i removed that two files from my coding then this cods are working but iwant this two files also

here is the files that i used (Attached)

Edited by ruwanaru: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.