navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Do I have to convert the code??

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Do I have to convert the code??
Page: [1]
 
AirRazr

 

Posts: 29
From: Brentwood, TN USA
Status: offline

 
Do I have to convert the code?? - 3/30/2001 15:54:00   
Ok, I found the following code that will dynamically change the contents of a drop-down box based on user input. My question is, Since this is written in JavaScript, can I add VB Script to it, to be able to pull information from a SQL Database to populate the boxes or am I going to have to attempt to convert the entire script over into VB Script?

<SCRIPT Language="JavaScript"><!--

//Build arrays for each person's contacts
Contacts=new Array(4);
Contacts[0]=new Array(3);
Contacts[1]=new Array(2);
Contacts[2]=new Array(5);
Contacts[3]=new Array(4);

//Warehouse
Contacts[0][0]="Monday";
Contacts[0][1]="Tuesday";
Contacts[0][2]="Wednesday";
Contacts[0][3]="Thursday";
Contacts[0][4]="Friday";

//Local
Contacts[1][0]="Route 1";
Contacts[1][1]="Route 2";

//Rural
Contacts[2][0]="Franklin";
Contacts[2][1]="Hermitage";
Contacts[2][2]="Brentwood";
Contacts[2][3]="Bellvue";
Contacts[2][4]="Inglewood";
Contacts[2][5]="Smyrna";
Contacts[2][6]="Lavergne";
Contacts[2][7]="Murfreesboro";
Contacts[2][8]="Antioch";
Contacts[2][9]="Donelson";
Contacts[2][10]="Berry Hill";
Contacts[2][11]="Tusculum";


//Call this to build the Contact list for the specified Salesperson
function BuildContacts(num)
{
//Select the first Contact
document.myForm.SalesContacts.selectedIndex=0;

//For every contact in the array for this person, add a new option
for(ctr=0;ctr<Contacts[num].length;ctr++)
{
document.myForm.SalesContacts.options[ctr]=new Option(Contacts[num][ctr],Contacts[num][ctr]);
}
//Set the length of the select list
document.myForm.SalesContacts.length=Contacts[num].length;
}
//--></Script>

------------------
Wes
The world would be a better place if stupidity hurt
SCSI Business Solutions

Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Do I have to convert the code?? - 3/30/2001 21:07:00   
I dont play with JS much, but as its client side, youll need to write it to the browser.

Use VB to do this, writing all of the script tags etc as you normally would treat writing other html.

------------------
Spooky
"I am Spooky of Borg. Prepare to be assimilated, babycakes!"
Subscribe to OutFront News
Database / DRW Q & A
The Spooky Login!


(in reply to AirRazr)
AirRazr

 

Posts: 29
From: Brentwood, TN USA
Status: offline

 
RE: Do I have to convert the code?? - 4/2/2001 20:12:00   
Thanks, Spooky. What about the actual "java function" in the code that is used to call the variables. There are parts of it that I am not familiar with and kinda unsure about converting it over. Any ideas??

//Call this to build the Contact list for the specified Salesperson
function BuildContacts(num)
{
//Select the first Contact
document.myForm.SalesContacts.selectedIndex=0;

//For every contact in the array for this person, add a new option
for(ctr=0;ctr<Contacts[num].length;ctr++)
{
document.myForm.SalesContacts.options[ctr]=new Option(Contacts[num][ctr],Contacts[num][ctr]);
}
//Set the length of the select list
document.myForm.SalesContacts.length=Contacts[num].length;

------------------
Wes
The world would be a better place if stupidity hurt
SCSI Business Solutions


(in reply to AirRazr)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Do I have to convert the code?? - 4/2/2001 20:10:00   
I would assume that part of the javascript wouldnt change.
As long as the array is filled and the array numbers (Contacts[0][4]) are correct, it looks as if the function will accept it.

(in reply to AirRazr)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Do I have to convert the code??
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts