/    Sign up×
Community /Pin to ProfileBookmark

external javascript problems

Problem: sometimes our buttons don’t show up!

We have multiple screen that all have buttons at the bottom of the page. i.e. page forward. page backward, return.

To make the buttons all the same we developed an external script that contains all of the possible buttons. The script is about 9 kb.

The script works great, with one exception sometimes the buttons do not show up!!

The script start out as 11kb. We shrunk the script down in size and there did not seem to be as many errors. But. we are still getting these errors sometimes. Our customer only use Internet Explorer.

I am not sure if the script is to big or what??

How is an external script loaded? what if there are multiple scripts?

here is the code:

var ctr = 1;

var navTbl = “<table width=600> <tr> <td class=’header2′>”;

var tranTbl = “<table align=’center’ border=1 width=300 cellpadding=5 cells
var butnNm = ”;

var keyNm = ”;

var fnctNm = ”;

function createNonTransButtons

(fil,c,en,enn,en1,en1n,b,f,fp,lp,d,r,e,cl,f9,f9n,f10,f10n,f11,f11n,f12,f12

if (c != null){

if (c.toUpperCase() == ‘Y’){

butnNm = “DFH_ENTER”;

keyNm = “Continue”;

fnctNm = “processContinue()”;

wrtNTranLn();

}}

if (en != null){

if (en.toUpperCase() == ‘Y’){

butnNm = “DFH_ENTER”;

keyNm = enn;

fnctNm = “processEnter1()”;

wrtNTranLn();

}}

if (b != null){

if (b.toUpperCase() == ‘Y’){

butnNm = “DFH_PF7”;

keyNm = “Page back”;

fnctNm = “processPageBack()”;
wrtNTranLn();

}}

ChkforBrk();

if (f != null){

if (f.toUpperCase() == ‘Y’){

butnNm = “DFH_PF8”;

keyNm = “Page forward”;

fnctNm = “processPageFwd()”;

wrtNTranLn();

}}

ChkforBrk();

if (lp != null){

if (lp.toUpperCase() == ‘Y’){

butnNm = “DFH_PF4”;

keyNm = “Last page”;

fnctNm = “processLastPage()”;

wrtNTranLn();

}}

ChkforBrk();

if (d != null){

if (d.toUpperCase() == ‘Y’){

butnNm = “DFH_PF11”;

keyNm = “Directory”;

fnctNm = “processDirectory()”;

}}

ChkforBrk();

//** located here for prop & bop use of directory on the enter key
if (en3 != null){

if (en3.toUpperCase() == ‘Y’){

butnNm = “DFH_ENTER”;

keyNm = en3n;

fnctNm = “processEnter4()”;

wrtNTranLn();

}}

ChkforBrk();

//** located here for prop use of SIP button on the enter key

if (en4 != null){

if (en4.toUpperCase() == ‘Y’){

butnNm = “DFH_ENTER”;

keyNm = en4n;

fnctNm = “processEnter5()”;

wrtNTranLn();

}}

ChkforBrk();

if (f1 != null){

if (f1.toUpperCase() == ‘Y’){

butnNm = “DFH_PF1”;

keyNm = f1n;

fnctNm = “processF1Function()”;
wrtNTranLn();

}}

navTbl += “</td>”;

navTbl += “</tr>”;

navTbl += “</table>”;

navTbl += “<br>”;

navTbl += “<br>”;

document.write(navTbl);
}

function createTransButtons

(fil, EntInq, cmplt, cmpltrvw, sus, susrvw, clr, tosbk, binder){

tranTbl += “<tr><td align=’center’ class=’grey’> “;

tranTbl += “Transaction”;

tranTbl += “<br> “;

if (cmplt != null){

if (cmplt.toUpperCase() == ‘Y’){

butnNm = “DFH_ENTER”;

keyNm = “Complete”;

if (EntInq.toUpperCase() == ‘E’){

fnctNm = ‘processVerify99(“E”,this.form)’

}else{

fnctNm = ‘processVerify99(“I”,this.form)’

}

wrtTranLn2();

}}

tranTbl += “</td>”;

tranTbl += “</tr>”;

tranTbl += “</table>”;

document.write(tranTbl);

}
function wrtTranLn2(){

tranTbl += “<input type=’button’ Name='”;

tranTbl += butnNm;

tranTbl += “‘ value ='”;

tranTbl += keyNm;

tranTbl += “‘ onClick='”;

tranTbl += fnctNm;

tranTbl += “‘>”;

tranTbl += “&nbsp;”;

}

function wrtNTranLn(){

navTbl += “<input type=’submit’ Name='”;
navTbl += butnNm;

navTbl += “‘ value ='”;

navTbl += keyNm;

navTbl += “‘ onClick='”;

navTbl += fnctNm;

navTbl += “‘>”;

navTbl += “&nbsp;”;

ctr ++;

}

function wrtNTranLn2(){

navTbl += “<input type=’button’ Name='”;
navTbl += butnNm;

navTbl += “‘ value ='”;

navTbl += keyNm;

navTbl += “‘ onClick='”;

navTbl += fnctNm;

navTbl += “‘>”;

navTbl += “&nbsp;”;

ctr ++;

}

function ChkforBrk(){

if (ctr > ‘5’){

navTbl += “</td>”;

navTbl += “</tr>”;

navTbl += “<tr>”;

navTbl += “<td class=’header2′>”;

ctr = 1;

}}

I removed some of the redundent code…

Thanks for your help in advance!

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@chrismartzJul 04.2003 — To answer your first question, "no" your script is not too big.

to load an external script put this code in the head of your document. be sure to chang e the name of the .js file to the name and loacation you have it at:

[b]

<script language="JavaScript" src="external.js"></script>

[/b]


If you have multiple scripts be sure not to have the same function name repeated
Copy linkTweet thisAlerts:
@Esm3638authorJul 07.2003 — ?

Thanks for your reply!

We are importing the javascript into our code.


This code is used on hundreds of our pages, but for some reason some of the pages do not load up the script (we are assuming). That is why we thought that the script may be too big to load.

A lot of times the screens we are having problems with the buttons not showing up, are smaller than this external script.

Thanks for your help!!
×

Success!

Help @Esm3638 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...