| View previous topic :: View next topic |
| Author |
Message |
mvang
Joined: 29 Jan 2008 Posts: 65
|
Posted: Wed Nov 04, 2009 10:48 am Post subject: Advanced Script: Using same variable specs twice |
|
|
Can we use the same variable specs twice on two different functions.
For example:
var ccpath = 'http://www.four51.com/Themes/Custom/fad32.../DocumentActions/FrandsenFinancialInvestment/image_library/';
var logoList = spec['LogoChoice'];
logoList.imageSelector(
{
effect : 'fadeIn', bordercolor : "red", width : 500, height : 120, thumbnailsize : 90, bgcolor : "#fff", bordercolor : "#000", highlightcolor : "#ff0", debug : true, rollovertext : "Click this to enlarge logo",
images : [
ccpath + 'FBT.jpg',
ccpath + 'QCFB.jpg',
ccpath + 'RAB.jpg',
ccpath + 'VB.jpg' ]
}
);
var branchList = spec['BranchLocation'];
function refreshBranches()
{
branchList.hideAllOptions();
branchList.showOptionAt(0);
var logo = logoList.selectedText();
switch (logo)
{
case 'FBT.jpg' :
branchList.showOptionRange('Frandsen Bank and Trust - Ada', 'Frandsen Bank and Trust - Warren');
break;
case 'QCFB.jpg' :
branchList.showOptionRange('Queen City Federal - Carlton', 'Queen City Federal - Virginia');
break;
case 'RAB.jpg' :
branchList.showOptionRange('Rural American Bank - Braham/Pine City', 'Rural American Bank - Luck/Dresser');
break;
case 'VB.jpg' :
branchList.showOptionRange('Valley Bank - Fairfax', 'Valley Bank - Waterville');
break;
}
} |
|
| Back to top |
|
 |
Steve
Joined: 17 Jan 2008 Posts: 266
|
Posted: Thu Nov 05, 2009 10:29 am Post subject: Re: Advanced Script: Using same variable specs twice |
|
|
| mvang wrote: | Can we use the same variable specs twice on two different functions.
} |
Yes _________________ Steve
You can read about other advanced tech topics on the http://www.insightsfour51.com/?cat=3 |
|
| Back to top |
|
 |
mvang
Joined: 29 Jan 2008 Posts: 65
|
Posted: Thu Nov 05, 2009 10:54 am Post subject: |
|
|
Great!
So....my second function is not working.
Could it be...because the script below is referring to the logo file name?
var branchList = spec['BranchLocation'];
function refreshBranches()
{
branchList.hideAllOptions();
branchList.showOptionAt(0);
logoList.selectedText();
switch (logoList)
{
case 'FBT.jpg' :
branchList.showOptionRange('Frandsen Bank and Trust - Ada', 'Frandsen Bank and Trust - Warren');
break;
case 'QCFB.jpg' :
branchList.showOptionRange('Queen City Federal - Carlton', 'Queen City Federal - Virginia');
break;
case 'RAB.jpg' :
branchList.showOptionRange('Rural American Bank - Braham/Pine City', 'Rural American Bank - Luck/Dresser');
break;
case 'VB.jpg' :
branchList.showOptionRange('Valley Bank - Fairfax', 'Valley Bank - Waterville');
break;
}
} |
|
| Back to top |
|
 |
Steve
Joined: 17 Jan 2008 Posts: 266
|
|
| Back to top |
|
 |
mvang
Joined: 29 Jan 2008 Posts: 65
|
Posted: Thu Nov 05, 2009 11:31 am Post subject: |
|
|
I don't quite understand.
My goal is if select "FBT.jpg" logo than we want to only show FBT branch locations where my script indicate: case 'FBT.jpg' : branchList.showOptionRange('Frandsen Bank and Trust - Ada', 'Frandsen Bank and Trust - Warren');
Currently right now it's showing all.
Any help is greatly appreciated. Thank You.
MV |
|
| Back to top |
|
 |
Steve
Joined: 17 Jan 2008 Posts: 266
|
Posted: Thu Nov 05, 2009 11:36 am Post subject: |
|
|
ImageSelector is not a DropDownList. You can't treat it like that. The functions you are using are for DropDownLists. _________________ Steve
You can read about other advanced tech topics on the http://www.insightsfour51.com/?cat=3 |
|
| Back to top |
|
 |
mvang
Joined: 29 Jan 2008 Posts: 65
|
Posted: Thu Nov 05, 2009 12:11 pm Post subject: |
|
|
Ok. so looks like the imageselector idea doesn't work.
so if i go back to my old forum and use the dropdown logo options with thumbnail images i still have the issue when selecting the logo on the drop down it's not grabbing the right images. so instead my first function is not working and my second one is.
for example if i select the Valley Bank logo my branch locations only shows the Valley bank locations but it does not show the correct logo which should be VB.jpg instead it shows FBT.jpg.
But after i render the proof than the correct logo show.
Advanced Scriptvar preview = get('preview');
var logoList = spec['LogoChoice'];
var path = "http://www.four51.com/Themes/Custom/fad32e83-e533-45aa-a524-84ab6f5e08f9/DocumentActions/FrandsenFinancialInvestment/image_library/";
var images =
{
"Frandsen Bank and Trust" : "FBT.jpg",
"Queen City Federal Bank" : "QCFB.jpg",
"Rural American Bank" : "RAB.jpg",
"Valley Bank" : "VB.jpg"
}
function Display()
{
preview.imgSrc(path + images[logoList.selectedText()]);
}
logoList.onchange = Display;
logoList.removeOption(0);
spec ['Logos'].hide();
Display();
var branchList = spec['BranchLocation'];
function refreshBranches()
{
branchList.hideAllOptions();
branchList.showOptionAt(0);
var logo = logoList.selectedText();
switch (logo)
{
case 'Frandsen Bank and Trust' :
branchList.showOptionRange('Frandsen Bank and Trust - Ada', 'Frandsen Bank and Trust - Warren');
break;
case 'Queen City Federal Bank' :
branchList.showOptionRange('Queen City Federal - Carlton', 'Queen City Federal - Virginia');
break;
case 'Rural American Bank' :
branchList.showOptionRange('Rural American Bank - Braham/Pine City', 'Rural American Bank - Luck/Dresser');
break;
case 'Valley Bank' :
branchList.showOptionRange('Valley Bank - Fairfax', 'Valley Bank - Waterville');
break;
}
}
logoList.onchange = refreshBranches;
refreshBranches();
 |
|
| Back to top |
|
 |
|