spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source
JavaScript Tip of the Week for September 23, 1996: Source Code: Saving Space on Your Site

Simple Select Menu
A JavaScript Billboard
Modifiable Select Menu II



Put this code in the head of the page for the select menu:

/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */

function MakeArray()
        {
        this.length = MakeArray.arguments.length
        for (var i = 0; i < this.length; i++)
        this[i+1] = MakeArray.arguments[i]
        }

var siteopt = new MakeArray("Select a Page",
                            "Browse Past Tips",
                            "This Week",
                            "E-Mail",
                            "JavaScript Powered Tour",
                            "Tippettes");

var url = new MakeArray("",
                        "../tip_week_past.html",
                        "../this_week/index.html",
                        "../e-mail.html",
                        "../960617/index.html",
                        "../tippettes.html");

function jumpPage(form)
{
        i = form.SelectMenu.selectedIndex;
        if (i == 0) return;
        window.location.href = url[i+1];
}


Put this where you want the selet menu to be displayed:

    document.writeln('<FORM><SELECT NAME="SelectMenu" onChange="jumpPage(this.form)">');
    tot = siteopt.length;
        for (var i = 1; i <= tot; i++)
        document.write("<OPTION>" +siteopt[i]);
    document.writeln('</SELECT>');
    if (navigator.userAgent.indexOf("Mozilla/2") != -1)
    document.writeln('<INPUT TYPE = BUTTON VALUE = "Jump!">');
    document.writeln('</FORM>');



Put this code in the head of the page for the billboard:

/* This code is Copyright (c) 1996 Nick Heinle and Athenia Associates, 
 * all rights reserved. In order to receive the right to license this 
 * code for use on your site the original code must be copied from the
 * Web site webreference.com/javascript/. License is granted to user to 
 * reuse this code on their own Web site if and only if this entire copyright
 * notice is included. Code written by Nick Heinle of webreference.com.
 */

var boardNum = 0;
var transNum = 0;
var boardSpeed = 2000;
var transSpeed = 150;

billboard = new Array;
billboard[0] = new Image(31, 250);
billboard[0].src = "../this_week.gif";
billboard[1] = new Image(31, 250);
billboard[1].src = "../archive.gif";
billboard[2] = new Image(31, 250);
billboard[2].src = "../bguide.gif";

url = new Array;
url[0] = "../this_week/index.html";
url[1] = "../tip_week_past.html";
url[2] = "../guide/index.html";

trans = new Array;
trans[0] = new Image(31, 250);
trans[0].src = "trans0.gif";
trans[1] = new Image(31, 250);
trans[1].src = "trans1.gif";
trans[2] = new Image(31, 250);
trans[2].src = "trans2.gif";
trans[3] = new Image(31, 250);
trans[3].src = "trans3.gif";
trans[4] = new Image(31, 250);
trans[4].src = "trans4.gif";
trans[5] = new Image(31, 250);
trans[5].src = "trans5.gif";
trans[6] = new Image(31, 250);
trans[6].src = "trans6.gif";

function changeBoard() {
        if (transNum > trans.length - 1) {
        boardNum++;
        transNum = 0; 
                if (boardNum > billboard.length - 1) boardNum = 0;
        displayBoard();
        return;
        }
        else {
        document.billboardimg.src = trans[transNum].src;
        setTimeout("changeBoard()", transSpeed);
        }
transNum++;
}

function displayBoard() {
document.billboardimg.src = billboard[boardNum].src;
return;
}

function boardControl() {
trueboardSpeed = boardSpeed + (trans.length * transSpeed);
changeBoard();
setTimeout("boardControl()", trueboardSpeed);
}

function jumpBillboard() {
window.location.href = url[boardNum];
}


Put onLoad = "boardControl()" in the BODY tag and put this where you want the billboard displayed:
<A HREF = "javascript:jumpBillboard()"
 onMouseover = "window.status = url[boardNum];return true;"
 onMouseout = "window.status = '';return true;">
<IMG BORDER = 0 HEIGHT = 31 WIDTH = 250 SRC = "../this_week.gif" NAME = "billboardimg"></A>

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Whitepapers and eBooks

Symantec Whitepaper: Converging System and Data Protection for Complete Disaster Recovery
Intel Whitepaper: Comparing Two- and Four-Socket Platforms for Server Virtualization
IBM Solutions Brief: Go Green With IBM System xTM And Intel
HP eBook: Simplifying SQL Server Management
IBM Contest: Are You the Next Superstar? Join the "Search for the XML Superstar" Contest to Find Out
Intel PDF: Quad-Core Impacts More Than the Data Center
Intel PDF: Virtualization Delivers Data Center Efficiency
Go Parallel Article: PDC 2008 in Review
Avaya Article: Communication-Enabled Mashups: Empowering Both Business Owners and IT
Intel Whitepaper: Building a Real-World Model to Assess Virtualization Platforms
PDF: Intel Centrino Duo Processor Technology with Intel Core2 Duo Processor
Microsoft Article: Build and Run Virtual Machines with Hyper-V Server 2008
  Go Parallel Article: Q&A with a TBB Junkie
IBM Whitepaper: Innovative Collaboration to Advance Your Business
Internet.com eBook: Real Life Rails
IBM eBook: The Pros and Cons of Outsourcing
Internet.com eBook: Best Practices for Developing a Web Site
IBM CXO Whitepaper: The 2008 Global CEO Study "The Enterprise of the Future"
Avaya Article: Call Control XML in Action - A CCXML Auto Attendant
IBM CXO Whitepaper: Unlocking the DNA of the Adaptable Workforce--The Global Human Capital Study 2008
Adobe Acrobat Connect Pro: Web Conferencing and eLearning Whitepapers
Symantec Whitepaper: Comprehensive Backup and Recovery of VMware Virtual Infrastructure
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Fixing MySQL Replication · Firewall Guide: First Steps to Securing the Enterprise · VoxOx Tames the Tumultuous Communications Tangle