/    Sign up×
Community /Pin to ProfileBookmark

What’s Conflicting Here?

I’m new to Javascript, so please forgive if this question is elementary…

I’m using two scripts on the same page. Turns out one of the preload functions is causing the other script not to work.

The first script is for the image map:

[code=php]
<SCRIPT TYPE=”text/javascript”>
<!–

function newImage(arg) {
if (document.images) {
rslt = new Image();
rslt.src = arg;
return rslt;
}
}

function changeImages() {
if (document.images && (preloadFlag == true)) {
for (var i=0; i<changeImages.arguments.length; i+=2) {
document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}
}
}

var preloadFlag = false;
function preloadImages() {
if (document.images) {
navbar_01_navbar_03_over = newImage(“../../images/navbar/navbar_01-navbar_03_over.jpg”);
navbar_01_navbar_13_over = newImage(“../../images/navbar/navbar_01-navbar_13_over.jpg”);
ETC [/code]

The second script is for an image viewer:

[code=php]
<script src=”dw_core.js” type=”text/javascript”></script>
<script src=”dw_scroll.js” type=”text/javascript”></script>

<script type=”text/javascript”>
<!–

var pgLoaded = false;
var wndo = new Array(); // “window(s)” for scrollable content
function initScrLyr() {
pgLoaded=true;
// creat scrollable content area
// arg: id of div containing scrollable div(s)
wndo[0] = new dynObj(‘wn’);
// load scrolling content
// arg’s: array number of wndo, id of scroll div, id of table
loadScrLyr(0,’lyr1′,’t1′);
}

window.onload = initScrLyr;

//–>
</script>[/code]

The BODY TAG:

[code=php]<BODY BGCOLOR=#000000 LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 ONLOAD=”preloadImages();”>[/code]

When I take out the “preloadImages();” line, the image viewer works, but the rollovers on the image map don’t.

Is there any way to get these two scripts to play nice together?

Thank you in advance.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@requestcodeJan 02.2004 — You could try commenting out the window.onload statement in the second script and the call in in the onLoad event in your body tag like this:

onLoad="preloadImages();initScrLyr();"
Copy linkTweet thisAlerts:
@IgnatiusauthorJan 02.2004 — That worked!!

Dang, you guys are good. ?


Thank you so much!
×

Success!

Help @Ignatius 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,
)...