Copy link to clipboard
Copied
Hi , I need your help. \(´o `)/
When I get "DropDownList.items", the type of the variable dose not become "string".
Why??
----------------------------------------------------------------------------------------------------------------------------------
var ddList = new Array();
ddList = ["adobe","PSD","Japan"]; //all string array value
/***** create window ******/
var dlg =
"dialog{text:'Script Interface',bounds:[200,200,460,350],"+
"panel0:Panel{bounds:[10,10,240,140] , text:'' ,properties:{borderStyle:'etched',su1PanelCoordinates:true},"+
"ddownlist1:DropDownList{bounds:[10,20,100,45]},"+
"button1:Button{bounds:[10,55,100,80] , text:'Ok' },"+
"button2:Button{bounds:[110,55,200,80] , text:'Cancel' }}}";
var win = new Window(dlg, "click ok button!");
for(var i=0 ; i< ddList.length ; i++){
win.panel0.ddownlist1.add("item",ddList); // add elements to doropdownlist.
}
win.panel0.ddownlist1.selection=0;
/*****when "ok" button is clicked ... ******/
win.panel0.button1.onClick = function(){
var ddownlistItems= win.panel0.ddownlist1.items;
for(var i=0 ; i<ddownlistItems.length; i++){
/******** If when "isNaN" Command was returned to "true",then the type of the variable is "string",if it was returned to "false" ,then not "string". *****/
alert("ddownlistItems["+i+"]="+isNaN(ddownlistItems)) ;
}
}
win.show();
----------------------------------------------------------------------------------------------------------------------------------
I tried this script , "alert" was returned "ddownlistItems[0]=false".
but the setting of the dropdownlist items used "string" array.
Why does not the type of the variable become string?
thank you.
Because you are not testing the string only the index.
try..
alert(ddownlistItems +" = " +isNaN(ddownlistItems.text));
Copy link to clipboard
Copied
Because you are not testing the string only the index.
try..
alert(ddownlistItems +" = " +isNaN(ddownlistItems.text));
Copy link to clipboard
Copied
@ Paul Rigott,
Super Thanks! i was almost freaking out why when i call the alert and simple get ....selection it spits out the dropdown text. I did not now this was a string then. What kind of format or text is at that point? I thought when not asking for the index you automatically get the string and thus value. Im perhaps confused by other types of coding like python or flash scripting.
Copy link to clipboard
Copied
Ohh..!
I see!
I forgot the "text" Command。。。
Thank you very much!!!
\(⌒▽⌒)/