www.webdeveloper.com
Results 1 to 2 of 2

Thread: Javascript not working in firefox

  1. #1
    Join Date
    Apr 2007
    Posts
    89

    Question Javascript not working in firefox

    hi guys can someone have a look at this and tell me why the script does not work in fire fox as it works fine in IE.



    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>PONY EXPRESS HOME</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link href="style.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">

    var keylist="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"


    function generatepass(plength){
    temp=""
    for (i=0;i<plength;i++)
    temp+=keylist.charAt(Math.floor(Math.random()*keylist.length))
    return temp
    }

    function populateform(enterlength){
    document.pgenerate.id.value=generatepass(enterlength)

    }
    function getvalue(id){
    document.id.value=generatepass(id)
    document.write(id);
    }
    </script>

    <script type="text/javascript">
    <!--
    pricelist = new Array();
    //Create array item for every origin/destination location with the price
    pricelist[0] = new Array('Dublin 1', 'Dublin 1', ' 7.50');
    pricelist[1] = new Array('Dublin 1', 'Dublin 2', ' 7.50');
    pricelist[2] = new Array('Dublin 1', 'Dublin 3', ' 7.50');
    pricelist[3] = new Array('Dublin 1', 'Dublin 4', ' 7.50');
    pricelist[4] = new Array('Dublin 1', 'Dublin 5', ' 20.00');
    pricelist[5] = new Array('Dublin 1', 'Dublin 6', ' 15.00');
    pricelist[6] = new Array('Dublin 1', 'Dublin 7', ' 7.50');
    pricelist[7] = new Array('Dublin 1', 'Dublin 8', ' 7.50');
    pricelist[8] = new Array('dublin 1', 'Dublin 9', ' 20.00');
    pricelist[9] = new Array('Dublin 1', 'Dublin 10', ' 20.00');
    pricelist[10] = new Array('Dublin 1', 'Dublin 11', ' 20.00');
    pricelist[11] = new Array('Dublin 1', 'Dublin 12', ' 20.00');

    function getPrice() {

    originObj = document.getElementById('origin');
    destinObj = document.getElementById('destin');

    document.getElementById('input122').value = originObj.value;
    document.getElementById('input12').value = destinObj.value;

    priceAmt = false;

    //If price still not set, iterate through array
    if (!priceAmt) {
    for (i=0; i<pricelist.length; i++) {
    if (pricelist[i][0]==originObj.value && pricelist[i][1]==destinObj.value) {
    priceAmt = pricelist[i][2];
    }
    }
    }

    //If price still not set, iterate through array, reversing values
    if (!priceAmt) {
    for (i=0; i<pricelist.length; i++) {
    if (pricelist[i][1]==originObj.value && pricelist[i][0]==destinObj.value) {
    priceAmt = pricelist[i][2];
    }
    }
    }

    //Set the price
    document.getElementById('price').value = priceAmt;
    }

    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }

    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }

    function MM_findObj(n, d) { //v4.01
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && d.getElementById) x=d.getElementById(n); return x;
    }

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->
    </script>
    <script language="JavaScript">
    <!--
    function sendData() {
    var data = document.mf.data.value;
    var url = "confirm-order.htm";

    document.location.href = url + "?" + data;
    return false;

    }

    function MM_goToURL() { //v3.0
    var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
    for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
    }
    //-->
    </script>

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    First step is to open the JavaScript console and look for errors. Select Tools|JavaScript Console and look for errors.

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.60039 seconds
  • Memory Usage 2,849KB
  • Queries Executed 15 (?)
More Information
Template Usage (32):
  • (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
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (2)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (2)postbit
  • (2)postbit_onlinestatus
  • (2)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