View Full Version : Best Method for Multiple Scripiting?


mark4man
09-14-2003, 04:03 PM
Crew,

What's the best method for combining multiple scripts in the code.

On a page that had two scripts, I was at a loss as to what to do, so I split them up with the Comments in & out arrows, like so:

-----------------------------------------------------------------------------------------------------------------
<script language="JavaScript" type="text/JavaScript">

<!--
if (screen.width <= 1023) {
document.location = "main800.htm";
}
//--!>

<!--
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;BlahBlahBlah;
//-->

</script>
-----------------------------------------------------------------------------------------------------------------

& it seems to work fine.

But is this the common practice?

Please inform.

Thanks,

mark4man

amicus
09-17-2003, 12:45 AM
you don't need this line:

//--!>

<!--

but if you have it in there it shouldn't matter.

mark4man
09-18-2003, 01:01 AM
amicus,

Thanks.

If not that, then what separates the scripts?

Thanks,

mark4man

amicus
09-18-2003, 02:48 AM
nothing seperates the scripts. are you doing something i don't know? usually you don't need to seperate scripts. unless you're actually making 2 seperate scripts for what ever reason. in that case you'd use 2 seperate 'script' tags, one for each.

mark4man
09-18-2003, 02:57 PM
amicus,

>>are you doing something i don't know?<<

Nah . . . I'm just curious.

So . . . just a single line space between scripts will work, then?

Thanks,

mark4man