Forum start - Register
Name Password Forgot your password?

Forum start > web > development > Dynamically Updating Lists
Author
Thread
JDOG
Member


 

Location: 
Registered: 8/7/2006    Warnings: 0
Dynamically Updating Lists
Alright guys, I have a problem with a webpage I'm trying to create. I'm trying to update an unordered list dynamically. Essentially, there are menu items on the left hand side of the screen and when one is clicked, it is added to the list on the right hand side of the screen. This, I got no problem. The problem comes in when I try to delete the item on the right hand side of the screen. I want to be able to click the list item and have it delete from the list. I can't use a selection box...even though that would me so much easier. Here is some code, let me know if there are any solutions

<script type="text/javascript">
var count = 0;
function listadd()
{
++count;
var name = "item" + listcount;
document.getElementById("test1" ).innerHTML += "<li id="name" onclick="deleteitem(count)">' + name + '</li>'";
}

function deleteitem(a)
{
var name = "item" + a;
document.getElementById("name" ).style.visibility = 'hidden';
}
</script>


<input type="button" onclick="listtest()" value="My List" />
<ul id="test1">
</ul>

If there are any other easier solutions to this let me know. I have messed around with any trick that I have been able to find on the web. For the function deleteitem I had the most desirable results using the code up above but I have also tried messing with document.getElementById(name).innerHTML -=; now this leaves the bullet point and a NaN result. Hopefully this makes sense!
__________________
JDW
jdog44@gmail.com
10/4/2011 14:11 Link - Ip: Logged - Quote:
tr
Admin
avataren

 

Location: 
Registered: 4/11/2006      Warnings: 0
where do you have the rest of the code (i.e. is there a page online that we can look at)?
__________________
peace and java
10/4/2011 16:13 Link - Ip: Logged - Quote:
JDOG
Member


 

Location: 
Registered: 8/7/2006      Warnings: 0
It's for a web programming class and of course it's a larger assignment. I only gave you a smaller page i work with when I'm stuck on a larger problem, less complicated for me that way. I don't have it online anywhere. I will when I submit it but I don't want to submit it without it being done.

Submitted it last night but it's a build on top of project so if I can get this figured out it'd be nice for the next assignment and just for my own personal info. I'll give you guys the link. I want to get rid of the check boxes on the right side of the screen. (The beer menu was mandatory, didn't want you guys to think I was throwing them back here at home )

Jordan's Assignment

Thanks guys


(Last edit:: 10/5/2011 08:02)
__________________
JDW
jdog44@gmail.com
10/4/2011 16:58 Link - Ip: Logged - Quote:
tr
Admin
avataren

 

Location: 
Registered: 4/11/2006      Warnings: 0
i like the way i can credit the order by clicking the empty checkboxes.

is there a reason you went with checkboxes and only allow for one of each menu item to be ordered? what if i want to order 2 large pizzas?
__________________
peace and java
10/5/2011 09:23 Link - Ip: Logged - Quote:
JDOG
Member


 

Location: 
Registered: 8/7/2006      Warnings: 0
Hey now, stop ripping on my rushed piece of art lol. Well, both problems would be fixed if I can just get the unordered list figured out. I knew both problems existed but as it was coming up on the time it was due I ran out of time and mental capacity to keep it going. If I had the dynamic lists then they could order as many large pizza's as they wanted and there wouldn't be anything to uncheck for the to make their bill a little cheaper. The code above works fine for adding things to the list, I just can't take it away from the list...
__________________
JDW
jdog44@gmail.com
10/5/2011 13:24 Link - Ip: Logged - Quote:
Forum start > web > development > Dynamically Updating Lists

Quick reply
You need to login before you can post.


Powered by ASPBB v0.5.2
© 2004-2006 ASPBB Developers team