Go Back   Website Publisher Forums > Website Development > Website Programming & Databases


Thread Tools Rate Thread
Unread 03-16-2012, 11:48 PM   #1
shakemelikeapig's Avatar
Join Date: Dec 2009
Posts: 54
Dynamically replace Array content.

Hello All,

I have a code which works fine for what is does but I want to add in dynamically a new list to the Array...... from an input field.

The relevent part of the code reads as this for example........

var step_x_list=new Array("ca1sb2en1pg1itm1","ca1sb2en1pg1itm2","ca1sb 2en1pg1itm3")

but I need a way to dynamically replace the existing.... "ca1sb2en1pg1itm1","ca1sb2en1pg1itm2","ca1sb2en1pg 1itm3" seen above with a new list from an input field which holds the following say....... ca2sb2en2pg1itm1","ca2sb2en2pg1itm2","ca2sb2en2pg1 itm3

I have tried various ideas but none seem to be able to inject the new values in the space between the brackets.

Any thoughts.

For those just wondering what the code is and want to try it, it is a one piece code which can fire many different functions without requiring lots of individual bits of code to do same. The action usually happens in micro-seconds but I slowed it to a one second count between changes so you can see what is actually happening.

Below is a revised code if you want to see it working and also to give an idea about the Array part in which I want to add a different number set.
Copy the code and save in notepad as test.html
It can be opened as a web page. Remember to change the code tags to the correct script tags

var i_x_list=0
function fireFunctionList_x_list()
if (document.getElementById("locate_load_x_list").value == "end" || document.getElementById("locate_load_x_list").value == "undefined"){i_x_list=0;document.getElementById("locate_load_x_list").value=""}else{fireFunctionList_x_list_do()}
function fireFunctionList_x_list_do()
var step_x_list=new Array("ca1sb2en1pg1itm1","ca1sb2en1pg1itm2","ca1sb2en1pg1itm3","ca1sb2en1pg1itm4","ca1sb2en1pg1itm5","ca1sb2en1pg1itm6","ca1sb2en1pg1itm7",
var x_list = document.getElementById("final_locate_load_x_list").value;
var f_x_list = new Function(x_list); f_x_list();

shakemelikeapig is offline   Reply With Quote



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Review: Constant Content Chris Software & Services 35 07-17-2013 05:27 AM
Am I right about duplicate content in site promotion? Shyflower General Promotion 7 10-05-2008 08:52 AM
Duplicate Content MrGeeK General Management Issues 3 03-10-2006 07:52 AM
Interview with Chris from Constant Content Cutter General Chat 5 09-29-2005 08:18 AM

All times are GMT -7. The time now is 08:25 AM.

Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
Site Copyright 2003-2006 Jalic Inc. All rights reserved.