www.webdeveloper.com
Results 1 to 4 of 4

Thread: Option, options and Africa Cities list

  1. #1
    Join Date
    Nov 2009
    Posts
    109

    Unhappy Option, options and Africa Cities list

    I am writing a javascript software very big so I quote a passage where there is the error. I am trying to find it but I can not. Could you give me an help, please?

    prova_city.html

    Code:
    <!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>Documento senza titolo</title>
    <script type="text/javascript" src="theData.js"></script>
    <script type="text/javascript" src="timeFunctions.js"></script>
    </head>
    <body onload="writeItAll(Africa_Cities_List,africa);">
    <form name="myForm" method="get" action="">
    <select name="africa">
    <option value=""> </option>
    </select>
    </form>
    </body>
    </html>
    theData.js

    Code:
     var Africa_Cities_List = new Array();
      Africa_Cities_List[0] = new CityObj("Abidjan", 0, No_DST, "ABI");
      Africa_Cities_List[1] = new CityObj("Accra", 0, No_DST, "ACC");
      Africa_Cities_List[2] = new CityObj("Addis Ababa", 3, No_DST, "ADA");
      Africa_Cities_List[3] = new CityObj("Algiers", 1, UK_Europe_DST, "ALJ");
      Africa_Cities_List[4] = new CityObj("Antananarivo", 3, No_DST, "ANT");
      Africa_Cities_List[5] = new CityObj("Bamako", 0, No_DST, "BAM");
      Africa_Cities_List[6] = new CityObj("Benin City", 1, No_DST, "BEN");
      Africa_Cities_List[7] = new CityObj("Bloemfontein", 2, No_DST, "BLO");
      Africa_Cities_List[8] = new CityObj("Cairo", 2, UK_Europe_DST, "CAI");
      Africa_Cities_List[9] = new CityObj("Cape Town", 2, No_DST, "CTC");
      Africa_Cities_List[10] = new CityObj("Dakar", 0, No_DST, "DAK");
      Africa_Cities_List[11] = new CityObj("Dar-Es-Salaam", 3, No_DST, "DAR");
      Africa_Cities_List[12] = new CityObj("Durban", 2, No_DST, "DUR");
      Africa_Cities_List[13] = new CityObj("Freetown", 0, No_DST, "FRE");
      Africa_Cities_List[14] = new CityObj("Harare", 2, No_DST, "HAR");
      Africa_Cities_List[15] = new CityObj("Johannesburg", 2, No_DST, "JOH");
      Africa_Cities_List[16] = new CityObj("Kampala", 3, No_DST, "KAM");
      Africa_Cities_List[17] = new CityObj("Khartoum", 2, No_DST, "KAR");
      Africa_Cities_List[18] = new CityObj("Kinshasa", 1, No_DST, "KIN");
      Africa_Cities_List[19] = new CityObj("Luanda", 2, No_DST, "LUA");
      Africa_Cities_List[20] = new CityObj("Maputo", 2, No_DST, "MAP");
      Africa_Cities_List[21] = new CityObj("Mbala", 2, No_DST, "MBA");
      Africa_Cities_List[22] = new CityObj("Monrovia", 0, No_DST, "MON");
      Africa_Cities_List[23] = new CityObj("Ndjamena", 1, No_DST, "NDJ");
      Africa_Cities_List[24] = new CityObj("Pointe Noire", 1, No_DST, "PNO");
      Africa_Cities_List[25] = new CityObj("Port Elizabeth", 2, No_DST, "POE");
      Africa_Cities_List[26] = new CityObj("Pretoria", 2, No_DST, "PRE");
      Africa_Cities_List[27] = new CityObj("Rabat", 0, No_DST, "RBT");
      Africa_Cities_List[28] = new CityObj("Tripoli", 1, No_DST, "TRI");
      Africa_Cities_List[29] = new CityObj("Tsumeb", 2, No_DST, "TSU");
    timeFunctions.js

    Code:
    function CityObj(cityName, cityOffset, cityDST, cityAcronym) {
     this.cityName = cityName;
     this.cityOffset = cityOffset;
     this.cityDST = cityDST;
     this.cityAcronym = cityAcronym;
    }
    function writeItAll(theCityArray,continente) {
       var array_city = new Array(theCityArray.length+1);
       array_city[0]= new Option("&lt; Scegli citt&aacute; &gt;","&lt; Scegli citt&aacute; &gt;");
       for(var j=1; j < array_city.length+1; j++)
       {array_city[j] = new Option(theCityArray[j].cityName,theCityArray[j].cityAcronym);}
       for(var i=0; i < array_city.length+1; i++)
       {document.forms[0].continente.options[i] = array_city[i];}
    }
    I don't understand because it doesn't work. I can not move Africa_Cities_List variable and CityObj function from the files. I think that the problem is writeItAll but I am not sure.

    See you

    Marco

    Thanks for your help!
    Last edited by esacerbare; 12-27-2009 at 09:08 AM.

  2. #2
    Join Date
    Jul 2005
    Location
    Tangerang, Indonesia
    Posts
    171
    This is my version

    prova_city.html
    HTML Code:
    <!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>Documento senza titolo</title>
    <script type="text/javascript" src="timeFunctions.js"></script>
    <script type="text/javascript" src="theData.js"></script>
    </head>
    <body onload="writeItAll(Africa_Cities_List,'africa');">
    <form name="myForm" method="get" action="">
    <select name="africa">
    <option value=""> </option>
    </select>
    </form>
    </body>
    </html>
    theData.js
    Code:
    var No_DST="";
    var UK_Europe_DST = "";
    var Africa_Cities_List = new Array();
      Africa_Cities_List[0] = new CityObj("Abidjan", 0, No_DST, "ABI");
      Africa_Cities_List[1] = new CityObj("Accra", 0, No_DST, "ACC");
      Africa_Cities_List[2] = new CityObj("Addis Ababa", 3, No_DST, "ADA");
      Africa_Cities_List[3] = new CityObj("Algiers", 1, UK_Europe_DST, "ALJ");
      Africa_Cities_List[4] = new CityObj("Antananarivo", 3, No_DST, "ANT");
      Africa_Cities_List[5] = new CityObj("Bamako", 0, No_DST, "BAM");
      Africa_Cities_List[6] = new CityObj("Benin City", 1, No_DST, "BEN");
      Africa_Cities_List[7] = new CityObj("Bloemfontein", 2, No_DST, "BLO");
      Africa_Cities_List[8] = new CityObj("Cairo", 2, UK_Europe_DST, "CAI");
      Africa_Cities_List[9] = new CityObj("Cape Town", 2, No_DST, "CTC");
      Africa_Cities_List[10] = new CityObj("Dakar", 0, No_DST, "DAK");
      Africa_Cities_List[11] = new CityObj("Dar-Es-Salaam", 3, No_DST, "DAR");
      Africa_Cities_List[12] = new CityObj("Durban", 2, No_DST, "DUR");
      Africa_Cities_List[13] = new CityObj("Freetown", 0, No_DST, "FRE");
      Africa_Cities_List[14] = new CityObj("Harare", 2, No_DST, "HAR");
      Africa_Cities_List[15] = new CityObj("Johannesburg", 2, No_DST, "JOH");
      Africa_Cities_List[16] = new CityObj("Kampala", 3, No_DST, "KAM");
      Africa_Cities_List[17] = new CityObj("Khartoum", 2, No_DST, "KAR");
      Africa_Cities_List[18] = new CityObj("Kinshasa", 1, No_DST, "KIN");
      Africa_Cities_List[19] = new CityObj("Luanda", 2, No_DST, "LUA");
      Africa_Cities_List[20] = new CityObj("Maputo", 2, No_DST, "MAP");
      Africa_Cities_List[21] = new CityObj("Mbala", 2, No_DST, "MBA");
      Africa_Cities_List[22] = new CityObj("Monrovia", 0, No_DST, "MON");
      Africa_Cities_List[23] = new CityObj("Ndjamena", 1, No_DST, "NDJ");
      Africa_Cities_List[24] = new CityObj("Pointe Noire", 1, No_DST, "PNO");
      Africa_Cities_List[25] = new CityObj("Port Elizabeth", 2, No_DST, "POE");
      Africa_Cities_List[26] = new CityObj("Pretoria", 2, No_DST, "PRE");
      Africa_Cities_List[27] = new CityObj("Rabat", 0, No_DST, "RBT");
      Africa_Cities_List[28] = new CityObj("Tripoli", 1, No_DST, "TRI");
      Africa_Cities_List[29] = new CityObj("Tsumeb", 2, No_DST, "TSU");
    timeFunctions.js
    Code:
    function CityObj(cityName, cityOffset, cityDST, cityAcronym) {
     this.cityName = cityName;
     this.cityOffset = cityOffset;
     this.cityDST = cityDST;
     this.cityAcronym = cityAcronym;
    }
    function writeItAll(theCityArray,continente) {
       var array_city = [];//new Array(theCityArray.length+1);
       array_city.push(new Option("&lt; Scegli citt&aacute; &gt;","&lt; Scegli citt&aacute; &gt;"));
       for(var j=0; j < theCityArray.length; j++)
       {array_city.push(new Option(theCityArray[j].cityName,theCityArray[j].cityAcronym));}
       for(var i=0; i < array_city.length; i++)
       {document.forms[0].elements[continente].options[i] = array_city[i];}
     }
    Yerie Piscesa

  3. #3
    Join Date
    Nov 2009
    Posts
    109
    Wawwww! Thanks very much for your help!

  4. #4
    Join Date
    Jul 2005
    Location
    Tangerang, Indonesia
    Posts
    171
    Ok... no problem, you're welcome
    Yerie Piscesa

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.12904 seconds
  • Memory Usage 2,884KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (5)bbcode_code
  • (1)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates