Jump to content

[SOLVED] Trouble with cascading dropdown


mjcoco

Recommended Posts

I have a tag in the page where the drop down lists are for the .js file

 

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

 

and in the dropdown i have onchange="GetSecti()">

 

However in the GetSecti i had GetSecti(this.value)

But i was getting errors saying

Error: Object Expected

 

If i took them out i recieved the same error.  My .js file is as follows

 

// JavaScript Document
var xmlHttpfunction GetSecti()
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getselected.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
} 
}function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
//Internet Explorer
try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
}
return xmlHttp;
}

 

which of course then calls the get getselected.php file.  I had an alert in there which of course was not getting called since it seems as if the .js file is not being called.  Any help on this at all?

 

Thanks

Michael

Link to comment
Share on other sites

Not to be a pain, but this is not a javascript board, it is a PHP board.

 

Right well my problem is within my php page itself... I guess I should have mentioned that before...

 

 

<form action="insertfunc.php" method="post">
			<table width="446" height="110" border="0" align="left" cellpadding="20" cellspacing="20">
                <tr><td width="172" height="32">TAG:</td>
			<td width="262"><select name="Un" size="1" id="Un" onchange="GetSecti(str)">
      			<?php displayUn();?> 
      			</select>

 

 

The php displayUn() calls a php page that inserts the options from a MySQL database and values as the same thing and inserts it into a listbox.  In this one i added back the GetSecti(str) to test a few things.

 

Or maybe this still needs to be moved?  ???

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.