Click to See Complete Forum and Search --> : Desperate help! Conflicting Javascripts


apprentice
09-07-2003, 09:15 AM
Hi all,

Desperate help needed here. Have been tearing my hair out trying to find the conflict in the following.

Using OpenCube's DHTML Drop Down Menu and Nic Wolfe's Pop Up code generator.

I have figured out there must be an onLoad conflict, but I'll be damned if I know where.

Any help will be greatly appreciated!

The code is as follows:

*******************************************

<HTML>
<HEAD>
<TITLE>welcome to moneycents.info - childrens financial education</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1251">

<SCRIPT LANGUAGE="JavaScript">
<!-- Idea by: Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL: http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=315,height=242');");
}
// End -->
</script>

<script language="javascript"
type="text/javascript">

<!-- hide script from older browsers
function validateForm(subscribe)
{

if(""==document.forms.subscribe.name.value)
{
alert("Please enter your first name.");
document.forms.subscribe.name.focus();
return false;
}

if(""==document.forms.subscribe.last_name.value)
{
alert("Please enter your last name.");
document.forms.subscribe.last_name.focus();
return false;
}

if(""==document.forms.subscribe.email.value)
{
alert("Please enter your email address.");
document.forms.subscribe.email.focus();
return false;
}

}
stop hiding script -->
</script>


</HEAD>

<BODY bgcolor="6E2E8C" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onLoad="javascript:popUp('http://www.moneycents.info/popup/subscribe.html')">


<!-- QuickMenu Pro, Copyright (c) 1998-2003, OpenCube Inc., All Rights Reserved.
Visit www.opencube.com for current QuickMenu Pro downloads and information. -->

<script language="JavaScript1.2">dqm__codebase = "" //script folder location</script>
<script language="JavaScript1.2" src="sample_settings.js"></script>
<script language="JavaScript1.2" src="dqm_loader.js"></script>
<tr>
<td bgcolor="6E2E8C"><table width="750" border="0" cellspacing="0" cellpadding="0">

*****************************

The OpenCube code calls other scripts to make it cross broswer compatible. If possible, I'd prefer to leave the OpenCube script as is and just change the popup script to get it to work.

Many thanks in advance!

Khalid Ali
09-07-2003, 09:19 AM
one of them is using obvious onload event call in body tag,seems like the other will be in the import files somethinglike this

window.onload=.....

apprentice
09-07-2003, 09:23 AM
Hey Khalid Ali,

Thanks for the quick response.

So should I try to move all the window.onload functions in the files that OpenCube is calling into the BODY tag?

Cheers,

Apprentice

Khalid Ali
09-07-2003, 09:31 AM
because you do want all of your scripts to work right???:D

create a new function

function init(){

}

and then put all of the functions that are being called using window.onload in this function e.g. the body tag has this function in onload

popUp('http://www.moneycents.info/popup/subscribe.html')"

put it in the init function,it will look like this

function init(){
popUp('http://www.moneycents.info/popup/subscribe.html')"
//more functions here
}


once that all is done and all window.onload instances are deleted.

then just add this init in the body tags onload event .your body tag may llok like this

<BODY bgcolor="6E2E8C" LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onload="init()">