/    Sign up×
Community /Pin to ProfileBookmark

Multiple Scripts

I am new to Javascript, and have come accross some scripts from various JAVA sites that would be very useful on my webpages. However, if I try to insert more than one of these scripts all I get on the page when I preview it is the one working script that I initially inserted, and the text of the code of the second one I inserted. Any help please? Thanks

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@sstevensNov 21.2002 — I think that if you just separated the scripts with the <script> and </script> tags you should be able to use however many scripts you want. Maybe post the file as a text file for more help?
Copy linkTweet thisAlerts:
@JimWauthorNov 21.2002 — Below you will find the scripts I am trying to use. The first is a slideshow script . I have been playing with that script to see if I can place it where I want. I was able to get it to go into a single celled table, and now I can move it around. The second script is a multi-user login in script, very primitive, and not all that secure at all, I realize. But I am experimenting with this in hopes of adding some neat stuff to my site. I am using FrontPage 2000, on my WIN98se machine. It will be hosted on an Apache server, running FP Extensions. Thanks for your willingness to help.


<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<meta name="GENERATOR" content="Microsoft FrontPage 4.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<title>New Page 1</title>



</head>

<body onLoad="runSlideShow()">






<div align="left" style="width: 150; height: 162">

<left>

<table border="0" cellpadding="0" cellspacing="0" width="18%">

<tr>

<td width="100%"><SCRIPT LANGUAGE="JavaScript">


<!-- Begin

// Set slideShowSpeed (milliseconds)

var slideShowSpeed = 2000;

// Duration of crossfade (seconds)

var crossFadeDuration = 5;

// Specify the image files

var Pic = new Array();

// to add more images, just continue

// the pattern, adding to the array below

Pic[0] = 'pic1.jpg'

Pic[1] = 'pic2.jpg'

Pic[2] = 'pic3.jpg'

Pic[3] = 'pic4.jpg'

Pic[4] = 'pic5.jpg'

Pic[5] = 'pic6.jpg'

// do not edit anything below this line

var t;

var j = 0;

var p = Pic.length;

var preLoad = new Array();

for (i = 0; i < p; i++) {

preLoad[i] = new Image();

preLoad[i].src = Pic[i];

}

function runSlideShow() {

if (document.all) {

document.images.SlideShow.style.filter="blendTrans(duration=2)";

document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";

document.images.SlideShow.filters.blendTrans.Apply();

}

document.images.SlideShow.src = preLoad[j].src;

if (document.all) {

document.images.SlideShow.filters.blendTrans.Play();

}

j = j + 1;

if (j > (p - 1)) j = 0;

t = setTimeout('runSlideShow()', slideShowSpeed);

}

// End -->

</script>



<div align="left">

<table border="3" cellpadding="0" align="left" cellspacing="0" bordercolor="#FFFFFF">

<tr>

<td id="VU" height=15% width=15% align="left">

<p align="left">

<img src="1.jpg" name='SlideShow' width=150 height=150 align="left">

</p>

</td>

</tr>

</table>


</div>


<!-- Script Size: 2.13 KB -->

</td>

</tr>

</table>

</left>

</div>

</body>

</html>


AND this is the second script I would like to add to the page. below this line

__________________________________________________________________________________________

<!--

Script Name: Multiple Users

Website URL:


http://javascript.internet.com/passwords/multiple-users.html

Description: Rather not have one password for access the Members-Only

section of your site? Well, along comes this little JavaScript gem.


You can set up a separate username and password for as many members as

you want, and even give each a different page to go to after logging in!

-->


<!-- TWO STEPS TO INSTALL MULTIPLE USERS:

  • 1. Copy the first code into the HEAD of your HTML document

  • 2. Put the last coding into the BODY of your HTML document -->


  • <!-- STEP ONE: Copy this code into the HEAD of your login HTML document


    -->

    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">

    <!-- This script and many more are available free online at -->

    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin

    function Login(){

    var done=0;

    var username=document.login.username.value;

    username=username.toLowerCase();

    var password=document.login.password.value;

    password=password.toLowerCase();

    if (username=="member1" && password=="password1") {

    window.location="page1.html"; done=1; }

    if (username=="member2" && password=="password2") {

    window.location="page2.html"; done=1; }

    if (username=="member3" && password=="password3") {

    window.location="page3.html"; done=1; }

    if (done==0) { alert("Invalid login!"); }

    }

    // End -->

    </SCRIPT>

    <!-- STEP TWO: Paste this code into the BODY of your HTML document -->

    <BODY>

    <center>

    <form name=login>

    <table width=225 border=1 cellpadding=3>

    <tr><td colspan=2><center><font size="+2"><b>Members-Only

    Area!</b></font></center></td></tr>

    <tr><td>Username:</td><td><input type=text name=username></td></tr>

    <tr><td>Password:</td><td><input type=text name=password></td></tr>

    <tr><td colspan=2 align=center><input type=button value="Login!"

    onClick="Login()"></td></tr>

    </table>

    </form>

    </center>

    <p><center>

    <font face="arial, helvetica" size="-2">Free JavaScripts provided<br>

    by <a href="http://javascriptsource.com">The JavaScript

    Source</a></font>

    </center><p>

    <!-- Script Size: 1.60 KB -->
    Copy linkTweet thisAlerts:
    @sstevensNov 21.2002 — Arighty, we're using that same slideshow script - how funny. I ran the code below on my machine and it worked fine. I moved the javascripts in between the <head> tags - they tend to work better that way. You can still put the slide show wherever you want on the page. Hope this works out!


    -----------------------------
    <html>

    <head>

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin

    // Set slideShowSpeed (milliseconds)

    var slideShowSpeed = 2000;

    // Duration of crossfade (seconds)

    var crossFadeDuration = 5;

    // Specify the image files

    var Pic = new Array();

    // to add more images, just continue

    // the pattern, adding to the array below

    Pic[0] = 'pic1.jpg'

    Pic[1] = 'pic2.jpg'

    Pic[2] = 'pic3.jpg'

    Pic[3] = 'pic4.jpg'

    Pic[4] = 'pic5.jpg'

    Pic[5] = 'pic6.jpg'

    // do not edit anything below this line

    var t;

    var j = 0;

    var p = Pic.length;

    var preLoad = new Array();

    for (i = 0; i < p; i++) {

    preLoad[i] = new Image();

    preLoad[i].src = Pic[i];

    }

    function runSlideShow() {

    if (document.all) {

    document.images.SlideShow.style.filter="blendTrans(duration=2)";

    document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";

    document.images.SlideShow.filters.blendTrans.Apply();

    }

    document.images.SlideShow.src = preLoad[j].src;

    if (document.all) {

    document.images.SlideShow.filters.blendTrans.Play();

    }

    j = j + 1;

    if (j > (p - 1)) j = 0;

    t = setTimeout('runSlideShow()', slideShowSpeed);

    }

    // End -->

    </script>

    <SCRIPT LANGUAGE="JavaScript">



    <!-- This script and many more are available free online at -->

    <!-- The JavaScript Source!! http://javascript.internet.com -->



    <!-- Begin

    function Login(){

    var done=0;

    var username=document.login.username.value;

    username=username.toLowerCase();

    var password=document.login.password.value;

    password=password.toLowerCase();

    if (username=="member1" && password=="password1") {

    window.location="page1.html"; done=1; }

    if (username=="member2" && password=="password2") {

    window.location="page2.html"; done=1; }

    if (username=="member3" && password=="password3") {

    window.location="page3.html"; done=1; }

    if (done==0) { alert("Invalid login!"); }

    }

    // End -->

    </SCRIPT>

    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">

    <meta name="ProgId" content="FrontPage.Editor.Document">

    <title>New Page 1</title>

    </head>

    <body onLoad="runSlideShow()">

    <div align="left" style="width: 150; height: 162">

    <left>

    <table border="0" cellpadding="0" cellspacing="0" width="18%">

    <tr>

    <td width="100%">

    <div align="left">

    <table border="3" cellpadding="0" align="left" cellspacing="0" bordercolor="#FFFFFF">

    <tr>

    <td id="VU" height=15% width=15% align="left">

    <p align="left">

    <img src="1.jpg" name='SlideShow' width=150 height=150 align="left">

    </p>

    </td>

    </tr>

    </table>

    </div>

    </td>

    </tr>

    </table>

    </left>

    </div>

    <center>

    <form name=login>

    <table width=225 border=1 cellpadding=3>

    <tr><td colspan=2><center><font size="+2"><b>Members-Only

    Area!</b></font></center></td></tr>

    <tr><td>Username:</td><td><input type=text name=username></td></tr>

    <tr><td>Password:</td><td><input type=text name=password></td></tr>

    <tr><td colspan=2 align=center><input type=button value="Login!"

    onClick="Login()"></td></tr>

    </table>

    </form>

    </center>

    </body>

    </html>
    Copy linkTweet thisAlerts:
    @JimWauthorNov 22.2002 — Yes is does work. Thank you very much. I can work with this for a while. From what I see I need to make sure wach script has an

    // End -->

    </script>

    at the end of it. Thanks again
    Copy linkTweet thisAlerts:
    @Beach_BumNov 22.2002 — You do not need to keep repeating the script tags. You can put as much JavaScript as you want in between one set. This is a much better approach to ensure you do not get messed up, and for maintenance.
    ×

    Success!

    Help @JimW 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 2.22,
    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: @Samric24,
    tipped: article
    amount: 1000 SATS,

    tipper: Anonymous,
    tipped: article
    amount: 10 SATS,

    tipper: @neststayhome,
    tipped: article
    amount: 1000 SATS,
    )...