Jump to content

salman233

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

salman233's Achievements

Member

Member (2/5)

0

Reputation

  1. ok haku bro it,s like this i want to print countries using for loop i have new array country= new array('pakistan','usa'); ok now i want to print states of both countries['pakistan'] = new array ('punjab','sindh); country['usa']= new array ('bla','bla'); i want to do this using for loop my current code is shown above it displays nothing i want to display stated and countries meaning i want to print whole array
  2. i stated above em a newbie correct me where em wrong
  3. var Country = new Array('Pakistan','USA'); // pakistan Country['Pakistan'] = new Array('Punjab','Sindh'); Country['Pakistan']['Punjab'] = new Array('Faisalabad','Lahore','Multan'); Country['Pakistan']['Singh'] = new Array('Karachi'); // USA Country['USA'] = new Array('New York'); Country['USA']['New York'] = new Array('New York','New York2'); var State = Country[value][value]; for(i=0; i<State.length; i++) { document.write(State); } this code displays nothing i want to display multidimensional array using for loop but it displays nothing
  4. ok thanks guys question in short is that this is a var State= country['value'] if i print it with for loop it displays result now further printing it like this var State2= country['value1']['value2'] with for loop it don,t shows any result please tell me where i am wrong ?
  5. hello guys i want a little help with multidimensional arrays actually em making a currency convert with java script em stuck at point where i want to print a multidimensional array my code actually em a newbie <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script type="text/javascript"> var Country = new Array('Pakistan','USA'); // pakistan Country['Pakistan'] = new Array('Punjab','Sindh'); Country['Pakistan']['Punjab'] = new Array('Faisalabad','Lahore','Multan'); Country['Pakistan']['Singh'] = new Array('Karachi'); // USA Country['USA'] = new Array('New York'); Country['USA']['New York'] = new Array('New York','New York2'); ///////////////////////// function changecountry(value){ try{ var state_area = document.getElementById('state_area'); var state_drop = document.getElementById('state_drop'); if(value==''){ state_drop.innerHTML = ''; state_area.style.display = 'none'; //city_drop.innerHTML = ''; //city_area.style.display = 'none'; //empty check return false; } if(typeof Country[value] == 'undefined') return false; var newState = document.createElement('select'); newState.name = 'state'; newState.onChange = function (){ alert("hello") } var State = Country[value]+[value]; here is where i want to call country[state][city] from multi dimensional array and print throught for loop //alert(typeof nsewState.appendChild) for(var i=0,j=0; i<State.length,j<State[j].length; i++,j++){ var newoptState = document.createElement('option'); newoptState.value = State[i]; newoptState.innerHTML = State[i]; newState.appendChild(newoptState); } state_drop.innerHTML = ''; state_drop.appendChild(newState); state_area.style.display = 'block'; }catch(e){ alert(e.message) } } function changecity(value){ try{ var city_area = document.getElementById('city_area'); var city_drop = document.getElementById('city_drop'); if(value==''){ city_drop.innerHTML = ''; city_area.style.display = 'none'; //empty check return false; } if(typeof Country[value] == 'undefined') return false; var newCity = document.createElement('select'); newCity.name = 'city'; newCity.onChange = function (){ alert(23) } var City = Country[value]; //alert(typeof newState.appendChild) for(var i=0; i<City.length; i++){ var newoptCity = document.createElement('option'); newoptCity.value = City[i]; newoptCity.innerHTML = City[i]; newCity.appendChild(newoptCity); } city_drop.innerHTML = ''; city_drop.appendChild(newCity); city_area.style.display = 'block'; }catch(e){ alert(e.message) } } </script> </head> <body> <form> Country: <select name="country" onChange="changecountry(this.value)"> <option value="">Select</option> <option value="Pakistan">Pakistan</option> <option value="USA">USA</option> </select> <br> <div id="state_area" style="display:none;" onChange="changecity(this.value)">State: <span id="state_drop" onChange="changecity(this.value)"></span></div> <div id="city_area" style="display:none;">City: <span id="city_drop"></span></div> </form> </body> </html> i want to call country[state][city] through for loop but gives a error but when i call country[state] only it,s displays country and onclick displays states please help me out where em wrong
  6. ok brother please tell how to calculate sum of a row from database
  7. i can,t figure out how to do it cause em a newbie
  8. guys i want help with little simple thing alright i want to make a pizza production mechanisum i have a input field pizza ------------------------ when i make 8 pizza,s in one day it should save 8 on that day on the next it should add those 8 previous day pizza including pizza made that days say 8+ 16 made today and so on adding previous days pizza and so on and good part is it should have a minus function too it should be like a calculator please help me out guys i am weak in maths
  9. i think i have backed up all the database files that includes default xampp files any solution?
  10. but i selected all of my database in the list for backup
×
×
  • 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.