;

PDA

Click to See Complete Forum and Search --> : [RESOLVED] ComboBox + AS ... problem


alfonso77italy
04-24-2009, 08:33 AM
i have a ComboBox (flash 8) and this is my AS code in section 'onchange'. The problem is that if i select the first (v=='1') i view the window with the values of javascript, but if i select other (vv='2' etc...) not open the javascript window.
what can i do?

thank you for yours attention.






var v = _root.combobox1.getValue();

if (v=='1'){
getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor1.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
} else if (v=='2'){
getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor2.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
} else if (v=='3'){
getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor3.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
} else if (v=='4'){
getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor4.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
} else if (v=='5'){
getURL("javascript:NewWindow=window.open('http://localhost/xalshop/UplSponsor5.asp','newWin','width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no'); NewWindow.focus();void(0);");
}

blanius
04-24-2009, 12:09 PM
Not sure why it's not working but for starters let's simplify it, this might make it easier to figure out what's wrong.

Firstly if you when you are in the onChange event for the combobox you don't have to refer to it by name you can and should use "this."

Then In the combobox you can set a value for each item so rather than a load of if and else if statements set the value of each choice to the "http://localhost/xalshop/...." Then your onChange looks like this.
Also I think you need to escape the single quotes as shown.
I did not test this but might get you in the right direction.


onChange = function(v){
getUrl("javascript:NewWindow=window.open(\'"+v+"\',\'newWin\',\'width=570,height=300,le ft=10 0,top=50,toolbar=No,location=No,scrollbars=no,stat us=No,resizable=no,fullscreen=no\'); NewWindow.focus();void(0);"
}

alfonso77italy
04-24-2009, 03:21 PM
Very good Blanius,
with your help i have resolved. The problem was that i must use "this".

Good job