Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9015495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:45:52+00:00 2026-06-16T03:45:52+00:00

HTML code : <form> <tr><td align=center> <p><select size=1 id=breed_list name=D1 onChange=editBreed(this.value);> <option>Select Cattle Breed</option>

  • 0

HTML code :

<form>
  <tr><td align="center">
    <p><select size="1" id="breed_list" name="D1" onChange="editBreed(this.value);"> 
      <option>Select Cattle Breed</option>
      <?php while(list($id, $breed)=mysql_fetch_row($result1)) {
        echo "
        <option value=\"".$id."\">".$breed."</option>";
      } ?>
      </select></p>
    </td></tr>
</form>

Javascript code :

<script type="text/javascript">
function editBreed(str){
    alert("Made it to Edit Breed"+ str);
    if (str=="" || str=="Select Cattle Breed") {
        document.getElementById("animal_data").innerHTML="";
        return;
    }

    if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
    } else { // code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }

     xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4 && xmlhttp.status==200) {
            document.getElementById("animal_data").innerHTML=xmlhttp.responseText;
        }
    }

    xmlhttp.open("GET","editbreed.php?d="+str+,true);
    xmlhttp.send();
}
</script>

If I modify the select to read onChange="alert(this.value);">, it displays the correct record, for some reason though it’s not going to the function and showing me the alert that’s there.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:45:54+00:00Added an answer on June 16, 2026 at 3:45 am

    On the second to last line in your function, there is a syntax error that is causing the function not to run at all.

    xmlhttp.open("GET","editbreed.php?d="+str+,true);
    

    remove the + after str

    xmlhttp.open("GET","editbreed.php?d="+str,true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My HTML code: <p>NEWS</p> <p> <form action=news.php method=post> <center><input name=NEW type=submit id=new value=NEW/> <input
This is my code. <form name=publish> <?php include 'location.selector.html'; ?> <input type=submit value=submit/> </form>
my problem is the following: This is a part of my HTML-Code: <form method='GET'
I have a simple situation here. lets face html code first => <form name=geoKey
The below HTML/CSS/Javascript (jQuery) code displays the #makes select box. Selecting an option displays
I am trying to echo a result from xml into my html code form
Pls check code .html form gets submitted even if javascript returns false. <form id=form1
Trying to customize Symfony2 form to produce html code looking like the following example:
I have the following html code: <form> <table> <tbody> <tr> <td> <span>Quantity<span class=pull-right>3</span> <input
In my HTML code, I have a form tag that contains two input boxes,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.