Click to See Complete Forum and Search --> : Best Method for Multiple Scripiting?


mark4man
09-14-2003, 11:09 AM
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

pyro
09-14-2003, 01:02 PM
Nah, just do it like this:

<script type="text/javascript">
<!--
if (screen.width <= 1023) {
document.location.href = "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> Though I'm not sure what the heck BlahBlahBlah; is, unless it is supposed to be representing additional code...

mark4man
09-15-2003, 07:01 PM
Pyro,

Thanks,

mark4man

BTW - >>not sure what the heck BlahBlahBlah; is, unless it is supposed to be representing additional code...<<

Yes.

pyro
09-15-2003, 07:05 PM
No problem... :)