homepage Welcome to WebmasterWorld Guest from 50.19.172.0
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Array Issue
stevelibby

10+ Year Member



 
Msg#: 3603874 posted 11:34 am on Mar 18, 2008 (gmt 0)

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

5+ Year Member



 
Msg#: 3603874 posted 9:30 am on Mar 19, 2008 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved