View Full Version : Need Help with Javascript Conflict

10-17-2006, 03:06 AM
I know absolutely nothing about javascript.
Can Someone help me.

I have two scripts
1 in the Head:<script type="text/javascript" src="budget.js"></script>
1 in the Body: <script language="JavaScript" src="header.js"></script>

When I remove the header.js, my calculator works
When I remove the budget.js, my header works

Can someone tell me how I can change the code so the they both work?
Thank You,

10-17-2006, 03:55 AM
It is difficult to comment what exactly creates the problem in your case as you haven't provided the source code of both header.js and budget.js.

The assumption is you've used a key variable which needed for your calculator in the header.js in a reverse manner that mess up the execution of your calculator script.

10-17-2006, 01:25 PM
Remember I said I know little of programming, this is my weak attempt at a calculator. THank you for your input, Michele
This is Calculator:
// This Calculator generated by the
// Budget Calculator Generator Javascript
// at http://javascript.about.com/library/blbudget.htm
function stripBlanks(fld) {var result = "";var c = 0;for (i=0; i < fld.length; i++) {if (fld.charAt(i) != " " || c > 0){ result += fld.charAt(i); if (fld.charAt(i) != " ") c = result.length;}} return result.substr(0,c);}
function budget(thisform) {
var result = 0;
var in1 = stripBlanks(thisform.in1.value);
if (in1 != '' && in1 != parseFloat(in1)) {alert("Income must be numeric");thisform.in1.focus();return false;}
result += Number(in1);
var in2 = stripBlanks(thisform.in2.value);
if (in2 != '' && in2 != parseFloat(in2)) {alert("Other Income must be numeric");thisform.in2.focus();return false;}
result += Number(in2);
var ex01 = stripBlanks(thisform.ex01.value);
if (ex01 != '' && ex01 != parseFloat(ex01)) {alert("Rent/Mortgage must be numeric");thisform.ex01.focus();return false;}
result -= Number(ex01);
var ex02 = stripBlanks(thisform.ex02.value);
if (ex02 != '' && ex02 != parseFloat(ex02)) {alert("Property Tax/Ins must be numeric");thisform.ex02.focus();return false;}
result -= Number(ex02);
var ex03 = stripBlanks(thisform.ex03.value);
if (ex03 != '' && ex03 != parseFloat(ex03)) {alert("Electricty/Gas must be numeric");thisform.ex03.focus();return false;}
result -= Number(ex03);
var ex04 = stripBlanks(thisform.ex04.value);
if (ex04 != '' && ex04 != parseFloat(ex04)) {alert("Water/Trash must be numeric");thisform.ex04.focus();return false;}
result -= Number(ex04);
var ex05 = stripBlanks(thisform.ex05.value);
if (ex05 != '' && ex05 != parseFloat(ex05)) {alert("Food must be numeric");thisform.ex05.focus();return false;}
result -= Number(ex05);
var ex06 = stripBlanks(thisform.ex06.value);
if (ex06 != '' && ex06 != parseFloat(ex06)) {alert("Alcohol/Tobacco must be numeric");thisform.ex06.focus();return false;}
result -= Number(ex06);
var ex07 = stripBlanks(thisform.ex07.value);
if (ex07 != '' && ex07 != parseFloat(ex07)) {alert("Entertainment must be numeric");thisform.ex07.focus();return false;}
result -= Number(ex07);
var ex08 = stripBlanks(thisform.ex08.value);
if (ex08 != '' && ex08 != parseFloat(ex08)) {alert("Child Care must be numeric");thisform.ex08.focus();return false;}
result -= Number(ex08);
var ex09 = stripBlanks(thisform.ex09.value);
if (ex09 != '' && ex09 != parseFloat(ex09)) {alert("Child Support must be numeric");thisform.ex09.focus();return false;}
result -= Number(ex09);
var ex10 = stripBlanks(thisform.ex10.value);
if (ex10 != '' && ex10 != parseFloat(ex10)) {alert("Life/Health Ins must be numeric");thisform.ex10.focus();return false;}
result -= Number(ex10);
var ex11 = stripBlanks(thisform.ex11.value);
if (ex11 != '' && ex11 != parseFloat(ex11)) {alert("Car Loan must be numeric");thisform.ex11.focus();return false;}
result -= Number(ex11);
var ex12 = stripBlanks(thisform.ex12.value);
if (ex12 != '' && ex12 != parseFloat(ex12)) {alert("Auto Insurance must be numeric");thisform.ex12.focus();return false;}
result -= Number(ex12);
var ex13 = stripBlanks(thisform.ex13.value);
if (ex13 != '' && ex13 != parseFloat(ex13)) {alert("Transportation must be numeric");thisform.ex13.focus();return false;}
result -= Number(ex13);
var ex14 = stripBlanks(thisform.ex14.value);
if (ex14 != '' && ex14 != parseFloat(ex14)) {alert("Credit Card Pmts must be numeric");thisform.ex14.focus();return false;}
result -= Number(ex14);
var ex15 = stripBlanks(thisform.ex15.value);
if (ex15 != '' && ex15 != parseFloat(ex15)) {alert("Installment Loans must be numeric");thisform.ex15.focus();return false;}
result -= Number(ex15);
var ex16 = stripBlanks(thisform.ex16.value);
if (ex16 != '' && ex16 != parseFloat(ex16)) {alert("Miscellaneous must be numeric");thisform.ex16.focus();return false;}
result -= Number(ex16);
var ex17 = stripBlanks(thisform.ex17.value);
if (ex17 != '' && ex17 != parseFloat(ex17)) {alert("Telephone/Cell must be numeric");thisform.ex17.focus();return false;}
result -= Number(ex17);
var ex18 = stripBlanks(thisform.ex18.value);
if (ex18 != '' && ex18 != parseFloat(ex18)) {alert("Cable must be numeric");thisform.ex18.focus();return false;}
result -= Number(ex18);
var ex19 = stripBlanks(thisform.ex19.value);
if (ex19 != '' && ex19 != parseFloat(ex19)) {alert("Computer/Internet must be numeric");thisform.ex19.focus();return false;}
result -= Number(ex19);
var ex20 = stripBlanks(thisform.ex20.value);
if (ex20 != '' && ex20 != parseFloat(ex20)) {alert("Savings must be numeric");thisform.ex20.focus();return false;}
result -= Number(ex20);
thisform.res.value = result;}

This is Header:
document.write('<nobr><img src="picts/top_bar.jpg" width="305" height="60" vspace="3"><a href="http://prosperonline.us/"><img src="picts/banner.jpg" width="468" height="60" border="0" vspace="3"></a></nobr><br>');
document.write('<!-- TB 1 -->');
document.write('<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr>');
document.write('<td width="278" height="78">');
document.write('<table border="0" cellspacing="12" cellpadding="0" width="283" height="78" bgcolor="000000" background="picts/logo.gif"><tr><td valign="center" align="left">');

document.write('<a href="index.html" class="logo">Virtual Lending Group</a><br>');

document.write('<SPAN CLASS="slogan">"Helping Borrowers Make It Happen"<br><br>');


document.write('</td><td align="right" valign="top" background="picts/top-background.gif">');
document.write('<!-- LINK TABLE-->');
document.write('<table border="0" cellspacing="0" cellpadding="2"><tr><td colspan="6">');
document.write('<img src="picts/spacer.gif" width="50" height="9"><br>');

document.write('</td></tr><form action="index.html"><tr><td>');
document.write('<input type="submit" value="Home" onmouseover="this.className=\'buttonon\'" onmouseout="this.className=\'button\'" class="button"><br>');

document.write('</td></form><form action="borrow.html"><td>');
document.write('<input type="submit" value="Borrow" onmouseover="this.className=\'buttonon\'" onmouseout="this.className=\'button\'" class="button"><br>');

document.write('</td></form><form action="lend.html"><td>');
document.write('<input type="submit" value="Lend" onmouseover="this.className=\'buttonon\'" onmouseout="this.className=\'button\'" class="button"><br>');

document.write('</td></form><form action="listing.html"><td>');
document.write('<input type="submit" value="Listings" onmouseover="this.className=\'buttonon\'" onmouseout="this.className=\'button\'" class="button"><br>');

document.write('</td></form><form action="Budget.html"><td>');
document.write('<input type="submit" value="Calculator" onmouseover="this.className=\'buttonon\'" onmouseout="this.className=\'button\'" class="button"><br>');

document.write('</td></form><form action="contact.html"><td>');
document.write('<input type="submit" value="Contact" onmouseover="this.className=\'buttonon\'" onmouseout="this.className=\'button\'" class="button"><br>');

document.write('<!-- LINK TABLE-->');
document.write('</td><td align="right" width="15">');
document.write('<img src="picts/top-end.gif" width="15" height="78"><br>');
document.write('<!-- TB 1 -->');

10-17-2006, 01:27 PM
It wont take the whole page, but here is the beginning codes...thank you, Michele

This is Calculator web html: <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<TITLE>Virtual Lending is a Prosper Group where individuals bid on loan opportunities on an auction platform</TITLE>
<meta name="Description" content="Virtal Lending introduces borrowers and lenders on Prosper's Loan Marketplace. The auction is similar to eBay, instead of listing and bidding on items, individuals bid on loans.">
<META NAME="Keywords" content="cash flow loans, personal loans, unsecured personal loans, unsecured loans, investment, investments, small business loans, loan, prosper, prosper loans, loans">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META name="Copyright" content="Copyright 2006 Virtual Lending http://prosperonline.us/">
<META name="Publisher" content="Virtual Lending http://prosperonline.us/">
<META name="Author" content="Virtual Lending http://prosperonline.us/">
<META http-equiv="Content-Language" content="en">
<META name="revisit-after" content="15 days">
<META name="robots" content="index, follow">
<META name="Rating" content="General">
<META name="Robots" content="All">

<link rel=StyleSheet href="corporatestyle.css" type="text/css" media="screen">

<script language="JavaScript" src="mouseover.js"></script>
<script language="JavaScript" src="blockerror.js"></script>
<script type="text/javascript" src="budget.js"></script>

<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#339966" VLINK="#663399" ALINK="#666666" leftmargin=20 rightmargin=20 topmargin=2 bottommargin=20 marginheight=0 marginwidth=0>

<TABLE cellpadding=0 cellspacing=0 border=0 width="760"><tr><td ALIGN="CENTER" VALIGN="TOP">

<script language="JavaScript" src="header.js"></script>
<img src="picts/fadein.jpg" width="760" height="30"><br>