Welcome to WebmasterWorld Guest from 50.19.53.104

Forum Moderators: open

Message Too Old, No Replies

Array Issue

     

stevelibby

11:34 am on Mar 18, 2008 (gmt 0)

10+ Year Member



Hi
im not massively great with javascript but i have found a double combo script that i can use for cat1 / cat2.
i am creating the data in asp page for the script to pick up, now look at this:
This works:
var Cat1Array = new Array
this doesnt
var Cat 1Array = new Array
i want the second one to work as this will in the parameters in the address bar. i have tried - + but htese havent worked either. Any ideas?
Can a replace be used in javascript?

here is some extra code:
<!-- Begin
var cat11Array = new Array("('Select cat1','',true,true)",
"('Somalia')",
"('Any')");
function populatecat1(inForm,selected) {
var selectedArray = eval(selected + "Array");
while (selectedArray.length < inForm.cat1.options.length) {
inForm.cat1.options[(inForm.cat1.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++) {
eval("inForm.cat1.options[i]=" + "new Option" + selectedArray[i]);
}
if (inForm.cat.options[0].value == '') {
inForm.cat.options[0]= null;
if ( navigator.appName == 'Netscape') {
if (parseInt(navigator.appVersion) < 4) {
window.history.go(0);
}
else {
if (navigator.platform == 'Win32' ¦¦ navigator.platform == 'Win16') {
window.history.go(0);
}
}
}
}
}
// End -->
</script>

MarkFilipak

9:30 am on Mar 19, 2008 (gmt 0)

5+ Year Member



A javascript variable name can contain only a-z, A-Z, 0-9, and _ and cannot start with a number.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month