|
Ok, I made a form on my headers footers page so the staff can submit info. I have an array in my code that will hold the submit data. The problem is, that I dont think that I am trying to access my array correctly when submitting data. I am currently doing: function SaveVid(){ var name = document.getElementById('vid_name'); var URL = document.getElementById('vid_url'); var descs = document.getElementById('vid_descs'); gfooter = document.getElementsByName('footer').item(0); gfooter.value = gfooter.value.vids.push(URL,name,descs); document.forms.item(0).submit(true); }I believe .push is a Javascript command after googling If not please tell me. I think the problem is : gfooter.value.vids.push(URL,name,descs); Can I do that?
Last Edit: May 21, 2007 1:39:54 GMT by fireindy
|
|
|
|
|
i don't think push takes more than one argument. ;/ though, i could be wrong.
have you tried push(URL + name + descs); ?
|
|
|
|
i don't think push takes more than one argument. ;/ though, i could be wrong. have you tried push(URL + name + descs); ? I've never used push(), but I'd assume it could take more than one parameter. The PHP function, for example, takes the array name as the first parameter, then every parameter after that is a value to add. However, for your code, I wouldn't use push() at all (if it even exists). I'd use gfooter.value += '[" ' + URL + ' "," ' + name + ' "," ' + descs + ' "],'; (Note: I just put in the spaces to show the breaks between the quotes; also, I'm assuming that you're adding a set of values into the global footer in an admin-editable code.)
|
Support Rob Scuderi, the #1 Penguins Defender!
"Behold: me! I have authority in this building."
|
|
|
|
You can't access an array in the footer because it's a string there.
Also, push accept as many parameters as you want.
|
|
|
|
|
i don't think push takes more than one argument. ;/ though, i could be wrong. have you tried push(URL + name + descs); ? I've never used push(), but I'd assume it could take more than one parameter. The PHP function, for example, takes the array name as the first parameter, then every parameter after that is a value to add. However, for your code, I wouldn't use push() at all (if it even exists). I'd use gfooter.value += '[" ' + URL + ' "," ' + name + ' "," ' + descs + ' "],'; (Note: I just put in the spaces to show the breaks between the quotes; also, I'm assuming that you're adding a set of values into the global footer in an admin-editable code.) Well I could do that, but Id have to find the array in the string(thanks Chris), first. Thanks guys, I have to think about this one
|
|
|
|
|
I've never used push(), but I'd assume it could take more than one parameter. The PHP function, for example, takes the array name as the first parameter, then every parameter after that is a value to add. However, for your code, I wouldn't use push() at all (if it even exists). I'd use gfooter.value += '[" ' + URL + ' "," ' + name + ' "," ' + descs + ' "],'; (Note: I just put in the spaces to show the breaks between the quotes; also, I'm assuming that you're adding a set of values into the global footer in an admin-editable code.) Well I could do that, but Id have to find the array in the string(thanks Chris), first. Thanks guys, I have to think about this one You have a couple of choices as I see it. Use the replace method on the global footer textarea to replace the string array in there and add more so it can be read on other pages. Or you could pull the array out using regular expressions then use an eval() on the string you pulled out and push from there. Then you could make that into another string and use replace. Either way you will be using replace and the second way is just longer and more trouble. I would go the first route as it's more direct.
|
Greg says: Coding music... Greg says: Hmm... Greg says: I wouldn't rule it out. Chris 3.0 [New features? Yes.] says:
Greg says: If you think about machine code it's a bunch of 1s and 0s Chris 3.0 [New features? Yes.] says: Anything is possible. Greg says: Yeah try to code Metallica Chris 3.0 [New features? Yes.] says: Yeah, I'll get right on that... right after I learn to fly.
|
|
|