• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Why does not the type of the variable become string?

Guest
Feb 09, 2011 Feb 09, 2011

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.

TOPICS
Actions and scripting

Views

917

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Feb 09, 2011 Feb 09, 2011

Because you are not testing the string only the index.

try..

alert(ddownlistItems +" = " +isNaN(ddownlistItems.text));

Votes

Translate

Translate
Adobe
Valorous Hero ,
Feb 09, 2011 Feb 09, 2011

Copy link to clipboard

Copied

Because you are not testing the string only the index.

try..

alert(ddownlistItems +" = " +isNaN(ddownlistItems.text));

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 22, 2017 Aug 22, 2017

Copy link to clipboard

Copied

LATEST

@ 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.    

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 09, 2011 Feb 09, 2011

Copy link to clipboard

Copied

Ohh..!

I see!

I forgot the "text" Command。。。

Thank you very much!!!

\(⌒▽⌒)/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines