Java Script only working on IE

  • anoxicblaze
  • Born
  • Born
  • anoxicblaze
  • Posts: 1

Post 3+ Months Ago

I have the following Java in my script which adds variables to fill in the forms Item Cost, Delivery Cost & Total. it works on IE but not on Firefox or on a Mac. Any ideas?
Code: [ Select ]
<script language="JavaScript" type="text/JavaScript">
<!--
 
function FillTerms(nbr) {
    var str = "";
    switch(nbr) {
        case "2-4-1": {
            str = "<div style='font-weight:bold'>2 games of bowling for the price of one</div>"
                + "<ul>"
                + "<li>Offer subject to availability"
                + "<li>Valid all day (day?) to (day?)"
                + "<li>Valid for up to 6 people of any age each purchasing one game of bowling at full tariff rate."
                + "<li>Free and paid for games must be played consecutively."
                + "<li>Voucher not for resale."
                + "<li>Cannot be used in conjunction with any other offer."
                + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
                + "<li>Photocopies are not accepted. "
                + "</ul>";
            break;
        }
        case "2.50 per game": {
            str = "<div style='font-weight:bold'>£2.50 per game of bowling</div>"
                + "<ul>"
                + "<li>Offer subject to availability"
                + "<li>Valid all day (day?) to (day?)"
                + "<li>Valid for up to 6 people of any age each paying £2.50 per game of bowling"
                + "<li>Voucher not for resale."
                + "<li>Cannot be used in conjunction with any other offer."
                + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
                + "<li>Photocopies are not accepted"
                + "</ul>";
            break;
        }
        case "2 Games for X pounds": {
            str = "<div style='font-weight:bold'>2 games of bowling for £X.00</div>"
                + "<ul>"
                + "<li>Offer subject to availability."
                + "<li>Valid all day Monday to Friday."
                + "<li>Valid for up to 6 people, of any age, each purchasing 2 game of bowling for £X."
                + "<li>Voucher not for resale."
                + "<li>Cannot be used in conjunction with any other offer."
                + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
                + "<li>Photocopies are not accepted."
                + "</ul>";
            break;
        }
        case "50p off food": {
            str = "<div style='font-weight:bold'>50p off Burger and Fries</div>"
                + "<ul>"
                + "<li>Offer subject to availability."
                + "<li>Valid all day Monday to Friday."
                + "<li>Voucher not for resale."
                + "<li>No change given and no cash value."
                + "<li>Offer ends XX.XX.XX (excluding bank holidays)."
                + "<li>Photocopies are not accepted."
                + "</ul>";
            break;
        }
        case "50p off fruitshoot": {
            str = "<div style='font-weight:bold'>50p off any fruit shoot (including H2O)</div>"
                + "<ul>"
                + "<li>Offer subject to availability."
                + "<li>Valid all day Monday - Friday."
                + "<li>Voucher not for resale."
                + "<li>Voucher has no cash value."
                + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
                + "<li>Photocopies are not accepted."
                + "</ul>";
            break;
        }
        case "Free tea or coffee": {
            str = "<div style='font-weight:bold'>One free cup of tea or coffee</div>"
                + "<ul>"
                + "<li>One FREE cup of tea of coffee."
                + "<li>Offer subject to availability."
                + "<li>Valid all day Monday to Friday."
                + "<li>Voucher not for resale."
                + "<li>Voucher has no cash value."
                + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
                + "<li>Photocopies are not accepted."
                + "</ul>";
            break;
        }
        case "Free party place": {
            str = "<div style='font-weight:bold'>Free Birthday party place</div>"
                + "<ul>"
                + "<li>Birthday Child goes free when booking a birthday party. Minimum of 12 in party."
                + "<li>Offer subject to availability."
                + "<li>Offer available for any booking made before XX date."
                + "<li>Voucher has no cash value."
                + "<li>Voucher not for resale."
                + "<li>Offer ends XX.XX.XX (excluding bank holidays)."
                + "<li>Photocopies are not accepted"
                + "</ul>";
            break;
        }
        case "Organiser goes free": {
            str = "<div style='font-weight:bold'>Party organiser goes free</div>"
                + "<ul>"
                + "<li>Party organiser goes free when you book our 'Game for a Party' package for 10 or more."
                + "<li>Offer subject to availability."
                + "<li>Voucher not for resale."
                + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
                + "<li>Photocopies are not accepted."
                + "</ul>";
            break;
        }
       
        default: {
            break;
        }
    }
            document.getElementById("tdTerms").innerHTML = str;
 
}
 
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function validate()
{
flag=true;
if (document.getElementById('Artwork_no1').value==0)
{
    alert ("please  select Artwork Number");
    document.getElementById('Artwork_no1').focus();
    flag=false
    return flag;
}
 
if (document.getElementById('Custom_artwork').value==0)
{
    alert ("do you require custom artwork? please select");
    document.getElementById('Custom_artwork').focus();
    flag=false
    return flag;
}
 
if (document.getElementById('Unit_no').selectedIndex==0)
{
    alert ("please  select Unit No");
    flag=false
    return flag;
}
 if (document.getElementById('Purchase_order').value=="")
  {
   alert ("please attach your purchase order");
   document.getElementById('Purchase_order').focus();
    flag=false
    return flag;
  }
   if (document.getElementById('Purchase_no').value=="")
  {
   alert ("please enter purchase no");
    document.getElementById('Purchase_no').focus();
    flag=false
    return flag;
  }
if (document.getElementById('name').value=="")
    {
    alert ("please enter your name");
     document.getElementById('name').focus();
    flag=false
    return flag;
    }
if (document.getElementById('email').value=="")
    {
    alert ("please enter email address");
     document.getElementById('email').focus();
    flag=false
    return flag;
    }
   
 
}
//-->
</script>
<script>
<!--
function calctotal()
{
    var total=0;
     
    customise=document.getElementById('Custom_artwork').value;
    tickets=document.getElementById('Order1_tickets').value;
    Leaflets=document.getElementById('Order1_leaflets').value;
    posters1=document.getElementById('Order1_posters').value;
    posters2=document.getElementById('Order1_posters2').value;
    lightbox=document.getElementById('Order1_lightboxes').value;
    correx=document.getElementById('Order1_correxboards').value;
    runners=document.getElementById('Order1_runners').value
     
    if (customise=="")
        customise=0
    if (tickets=="")
        tickets=0
    if (Leaflets=="")
        Leaflets=0
    if (posters1=="")
        posters1=0
    if (posters2=="")
        posters2=0
    if (lightbox=="")
        lightbox=0
    if (correx=="")
        correx=0
    if (runners=="")
        runners=0
   
    total=parseFloat(customise)+parseFloat(tickets)+parseFloat(Leaflets)+parseFloat(posters1)+parseFloat(posters2)+parseFloat(lightbox)+parseFloat(correx)+parseFloat(runners);
   
    document.getElementById('Total').value=total ;
}
function calcdeliverytotal()
{
    var total=0;
     
    customise=document.getElementById('Custom_artwork').value.split("^");
    tickets=document.getElementById('Order1_tickets').value.split("^");
    Leaflets=document.getElementById('Order1_leaflets').value.split("^");
    posters1=document.getElementById('Order1_posters').value.split("^");
    posters2=document.getElementById('Order1_posters2').value.split("^");
    lightbox=document.getElementById('Order1_lightboxes').value.split("^");
    correx=document.getElementById('Order1_correxboards').value.split("^");
    runners=document.getElementById('Order1_runners').value.split("^")
   
    if (customise[2]==undefined)
        customise[2]=0
    if (tickets[2]==undefined)
        tickets[2]=0
    if (Leaflets[2]==undefined)
        Leaflets[2]=0
    if (posters1[2]==undefined)
        posters1[2]=0
    if (posters2[2]==undefined)
        posters2[2]=0
    if (lightbox[2]==undefined)
        lightbox[2]=0
    if (correx[2]==undefined)
        correx[2]=0
    if (runners[2]==undefined)
        runners[2]=0
     
    total=parseFloat(customise[2])+parseFloat(tickets[2])+parseFloat(Leaflets[2])+parseFloat(posters1[2])+parseFloat(posters2[2])+parseFloat(lightbox[2])+parseFloat(correx[2])+parseFloat(runners[2]);
     
    document.getElementById('deliverycost').value=total ;
     document.getElementById('totalcost').value=parseFloat(document.getElementById('deliverycost').value)+parseFloat(document.getElementById('Total').value)
}
 
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>
  1. <script language="JavaScript" type="text/JavaScript">
  2. <!--
  3.  
  4. function FillTerms(nbr) {
  5.     var str = "";
  6.     switch(nbr) {
  7.         case "2-4-1": {
  8.             str = "<div style='font-weight:bold'>2 games of bowling for the price of one</div>"
  9.                 + "<ul>"
  10.                 + "<li>Offer subject to availability"
  11.                 + "<li>Valid all day (day?) to (day?)"
  12.                 + "<li>Valid for up to 6 people of any age each purchasing one game of bowling at full tariff rate."
  13.                 + "<li>Free and paid for games must be played consecutively."
  14.                 + "<li>Voucher not for resale."
  15.                 + "<li>Cannot be used in conjunction with any other offer."
  16.                 + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
  17.                 + "<li>Photocopies are not accepted. "
  18.                 + "</ul>";
  19.             break;
  20.         }
  21.         case "2.50 per game": {
  22.             str = "<div style='font-weight:bold'>£2.50 per game of bowling</div>"
  23.                 + "<ul>"
  24.                 + "<li>Offer subject to availability"
  25.                 + "<li>Valid all day (day?) to (day?)"
  26.                 + "<li>Valid for up to 6 people of any age each paying £2.50 per game of bowling"
  27.                 + "<li>Voucher not for resale."
  28.                 + "<li>Cannot be used in conjunction with any other offer."
  29.                 + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
  30.                 + "<li>Photocopies are not accepted"
  31.                 + "</ul>";
  32.             break;
  33.         }
  34.         case "2 Games for X pounds": {
  35.             str = "<div style='font-weight:bold'>2 games of bowling for £X.00</div>"
  36.                 + "<ul>"
  37.                 + "<li>Offer subject to availability."
  38.                 + "<li>Valid all day Monday to Friday."
  39.                 + "<li>Valid for up to 6 people, of any age, each purchasing 2 game of bowling for £X."
  40.                 + "<li>Voucher not for resale."
  41.                 + "<li>Cannot be used in conjunction with any other offer."
  42.                 + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
  43.                 + "<li>Photocopies are not accepted."
  44.                 + "</ul>";
  45.             break;
  46.         }
  47.         case "50p off food": {
  48.             str = "<div style='font-weight:bold'>50p off Burger and Fries</div>"
  49.                 + "<ul>"
  50.                 + "<li>Offer subject to availability."
  51.                 + "<li>Valid all day Monday to Friday."
  52.                 + "<li>Voucher not for resale."
  53.                 + "<li>No change given and no cash value."
  54.                 + "<li>Offer ends XX.XX.XX (excluding bank holidays)."
  55.                 + "<li>Photocopies are not accepted."
  56.                 + "</ul>";
  57.             break;
  58.         }
  59.         case "50p off fruitshoot": {
  60.             str = "<div style='font-weight:bold'>50p off any fruit shoot (including H2O)</div>"
  61.                 + "<ul>"
  62.                 + "<li>Offer subject to availability."
  63.                 + "<li>Valid all day Monday - Friday."
  64.                 + "<li>Voucher not for resale."
  65.                 + "<li>Voucher has no cash value."
  66.                 + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
  67.                 + "<li>Photocopies are not accepted."
  68.                 + "</ul>";
  69.             break;
  70.         }
  71.         case "Free tea or coffee": {
  72.             str = "<div style='font-weight:bold'>One free cup of tea or coffee</div>"
  73.                 + "<ul>"
  74.                 + "<li>One FREE cup of tea of coffee."
  75.                 + "<li>Offer subject to availability."
  76.                 + "<li>Valid all day Monday to Friday."
  77.                 + "<li>Voucher not for resale."
  78.                 + "<li>Voucher has no cash value."
  79.                 + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
  80.                 + "<li>Photocopies are not accepted."
  81.                 + "</ul>";
  82.             break;
  83.         }
  84.         case "Free party place": {
  85.             str = "<div style='font-weight:bold'>Free Birthday party place</div>"
  86.                 + "<ul>"
  87.                 + "<li>Birthday Child goes free when booking a birthday party. Minimum of 12 in party."
  88.                 + "<li>Offer subject to availability."
  89.                 + "<li>Offer available for any booking made before XX date."
  90.                 + "<li>Voucher has no cash value."
  91.                 + "<li>Voucher not for resale."
  92.                 + "<li>Offer ends XX.XX.XX (excluding bank holidays)."
  93.                 + "<li>Photocopies are not accepted"
  94.                 + "</ul>";
  95.             break;
  96.         }
  97.         case "Organiser goes free": {
  98.             str = "<div style='font-weight:bold'>Party organiser goes free</div>"
  99.                 + "<ul>"
  100.                 + "<li>Party organiser goes free when you book our 'Game for a Party' package for 10 or more."
  101.                 + "<li>Offer subject to availability."
  102.                 + "<li>Voucher not for resale."
  103.                 + "<li>Offer ends XX.XX.XX (excluding bank holidays?)."
  104.                 + "<li>Photocopies are not accepted."
  105.                 + "</ul>";
  106.             break;
  107.         }
  108.        
  109.         default: {
  110.             break;
  111.         }
  112.     }
  113.             document.getElementById("tdTerms").innerHTML = str;
  114.  
  115. }
  116.  
  117. function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  118.   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  119.     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  120.   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  121. }
  122. MM_reloadPage(true);
  123. function validate()
  124. {
  125. flag=true;
  126. if (document.getElementById('Artwork_no1').value==0)
  127. {
  128.     alert ("please  select Artwork Number");
  129.     document.getElementById('Artwork_no1').focus();
  130.     flag=false
  131.     return flag;
  132. }
  133.  
  134. if (document.getElementById('Custom_artwork').value==0)
  135. {
  136.     alert ("do you require custom artwork? please select");
  137.     document.getElementById('Custom_artwork').focus();
  138.     flag=false
  139.     return flag;
  140. }
  141.  
  142. if (document.getElementById('Unit_no').selectedIndex==0)
  143. {
  144.     alert ("please  select Unit No");
  145.     flag=false
  146.     return flag;
  147. }
  148.  if (document.getElementById('Purchase_order').value=="")
  149.   {
  150.    alert ("please attach your purchase order");
  151.    document.getElementById('Purchase_order').focus();
  152.     flag=false
  153.     return flag;
  154.   }
  155.    if (document.getElementById('Purchase_no').value=="")
  156.   {
  157.    alert ("please enter purchase no");
  158.     document.getElementById('Purchase_no').focus();
  159.     flag=false
  160.     return flag;
  161.   }
  162. if (document.getElementById('name').value=="")
  163.     {
  164.     alert ("please enter your name");
  165.      document.getElementById('name').focus();
  166.     flag=false
  167.     return flag;
  168.     }
  169. if (document.getElementById('email').value=="")
  170.     {
  171.     alert ("please enter email address");
  172.      document.getElementById('email').focus();
  173.     flag=false
  174.     return flag;
  175.     }
  176.    
  177.  
  178. }
  179. //-->
  180. </script>
  181. <script>
  182. <!--
  183. function calctotal()
  184. {
  185.     var total=0;
  186.      
  187.     customise=document.getElementById('Custom_artwork').value;
  188.     tickets=document.getElementById('Order1_tickets').value;
  189.     Leaflets=document.getElementById('Order1_leaflets').value;
  190.     posters1=document.getElementById('Order1_posters').value;
  191.     posters2=document.getElementById('Order1_posters2').value;
  192.     lightbox=document.getElementById('Order1_lightboxes').value;
  193.     correx=document.getElementById('Order1_correxboards').value;
  194.     runners=document.getElementById('Order1_runners').value
  195.      
  196.     if (customise=="")
  197.         customise=0
  198.     if (tickets=="")
  199.         tickets=0
  200.     if (Leaflets=="")
  201.         Leaflets=0
  202.     if (posters1=="")
  203.         posters1=0
  204.     if (posters2=="")
  205.         posters2=0
  206.     if (lightbox=="")
  207.         lightbox=0
  208.     if (correx=="")
  209.         correx=0
  210.     if (runners=="")
  211.         runners=0
  212.    
  213.     total=parseFloat(customise)+parseFloat(tickets)+parseFloat(Leaflets)+parseFloat(posters1)+parseFloat(posters2)+parseFloat(lightbox)+parseFloat(correx)+parseFloat(runners);
  214.    
  215.     document.getElementById('Total').value=total ;
  216. }
  217. function calcdeliverytotal()
  218. {
  219.     var total=0;
  220.      
  221.     customise=document.getElementById('Custom_artwork').value.split("^");
  222.     tickets=document.getElementById('Order1_tickets').value.split("^");
  223.     Leaflets=document.getElementById('Order1_leaflets').value.split("^");
  224.     posters1=document.getElementById('Order1_posters').value.split("^");
  225.     posters2=document.getElementById('Order1_posters2').value.split("^");
  226.     lightbox=document.getElementById('Order1_lightboxes').value.split("^");
  227.     correx=document.getElementById('Order1_correxboards').value.split("^");
  228.     runners=document.getElementById('Order1_runners').value.split("^")
  229.    
  230.     if (customise[2]==undefined)
  231.         customise[2]=0
  232.     if (tickets[2]==undefined)
  233.         tickets[2]=0
  234.     if (Leaflets[2]==undefined)
  235.         Leaflets[2]=0
  236.     if (posters1[2]==undefined)
  237.         posters1[2]=0
  238.     if (posters2[2]==undefined)
  239.         posters2[2]=0
  240.     if (lightbox[2]==undefined)
  241.         lightbox[2]=0
  242.     if (correx[2]==undefined)
  243.         correx[2]=0
  244.     if (runners[2]==undefined)
  245.         runners[2]=0
  246.      
  247.     total=parseFloat(customise[2])+parseFloat(tickets[2])+parseFloat(Leaflets[2])+parseFloat(posters1[2])+parseFloat(posters2[2])+parseFloat(lightbox[2])+parseFloat(correx[2])+parseFloat(runners[2]);
  248.      
  249.     document.getElementById('deliverycost').value=total ;
  250.      document.getElementById('totalcost').value=parseFloat(document.getElementById('deliverycost').value)+parseFloat(document.getElementById('Total').value)
  251. }
  252.  
  253. function MM_swapImgRestore() { //v3.0
  254.   var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
  255. }
  256.  
  257. function MM_preloadImages() { //v3.0
  258.   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  259.     var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  260.     if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
  261. }
  262.  
  263. function MM_findObj(n, d) { //v4.01
  264.   var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  265.     d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  266.   if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  267.   for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  268.   if(!x && d.getElementById) x=d.getElementById(n); return x;
  269. }
  270.  
  271. function MM_swapImage() { //v3.0
  272.   var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
  273.    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
  274. }
  275. //-->
  276. </script>
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

Post Information

  • Total Posts in this topic: 1 post
  • Users browsing this forum: ScottG and 109 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.