PDA

View Full Version : VB scripting - drop down menu


fsherrar
06-14-2001, 08:59 AM
Can someone tell me how I could use VB scripting to create a drop down menu that you do not have to have a submit button to pass the value? Or is it possible, because I can only do it in JScript.

Dr. Web
06-14-2001, 02:10 PM
why vbscript? It is only supported in IE, and not netscape. It can be done in javascript....

heres asample from www.a1javascripts.com

<html><head>
<SCRIPT LANGUAGE = "JavaScript">
<!--

// Array Function

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

// This array holds the descriptions and names of the pages.

var pages = new makeArray("Select a Page",
"Home",
"A1 javaScripts",
"Reference",
"Demos",
"Talk Back");

// This array hold the URLs of the pages.

var urls = new makeArray("",
"/index.html",
"http://www.a1javascripts.com/",
"/reference/index.html",
"/demos/index.html",
"/talkback/index.html");

// This function determines which page is selected and goes to it.

function goPage(form) {
i = form.menu.selectedIndex;
if (i != 0) {
window.location.href = urls[i];
}
}

//-->
</SCRIPT>
</head><body>
<br><br>
Choose A Page and Jump:
<BR>
<SCRIPT LANGUAGE = "JavaScript">
<!--

// The select menu will be displayed wherever you place this code.

document.write('<FORM><SELECT NAME = "menu" onChange = "goPage(this.form)">');
for (var i = 0; i < pages.length; i++) {
document.write('<OPTION>' + pages[i]);
}
document.write('</SELECT></FORM>');

//-->
</SCRIPT>
</body></html>