|
|
|
|
![]() ![]() |
Nov 30 2007, 04:32 AM
Post
#1
|
|
|
|||[ n00b King ]||| ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 681 Joined: 20-June 07 From: Auckland Member No.: 45,102 |
I have a general question about how ajax updates div's. Have you ever wanted to update a element inside a <div> but not nesseary update the whole div?
here is an example CODE echo "<div id='heading_general'>"; echo "<h4>General <span id='general_total'>0</span> <button id='btn_general' onclick=\"tv('general_merits','btn_general');\">-</button></h4>"; echo "</div>"; like if I tried updating the span id of 'general_total' it will work but the output will be put on its own line so it messes up the format. the only other solution I have to this is updating the whoole div 'heading_general' and it will all be outputed to one line. I'm sure you can see the reason for this you will only update 1 element and not have reload all. |
|
|
|
Nov 30 2007, 07:46 PM
Post
#2
|
|
|
Ephesians 6:10-17 ![]() Group: [MODERATOR] Posts: 1,893 Joined: 22-June 05 From: The World of Gentoo Member No.: 8,528 ![]() |
I can understand the reason on why you would just want to update one element, but i'm trying to figure out why it places everything on its own line. I can only come up with a few reasons:
|
|
|
|
Nov 30 2007, 10:19 PM
Post
#3
|
|
|
|||[ n00b King ]||| ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 681 Joined: 20-June 07 From: Auckland Member No.: 45,102 |
The output was just an echo of "1"; I just did that to test out to change the original value of 0 to 1.
I dont think it gets put on a new line because of insuficent width space. because the final output is like this. 'General' '1' '<button>' when the original output is 'General' '1' '<button>' I tested it out on fire fox, safari and opera i believe and it does have the same effect on all 3. I am using a DTD of strict xhtml 1.0 maybe that has something to do with it. At this stage I'm happy with reloading an entire div just to keep moving forward on my project. Hopefully someone with similar issues or know a way do this method can let us know. I have posted this issue on ext forums but no response so far over there. thank you again for your response. |
|
|
|
Dec 6 2007, 01:27 AM
Post
#4
|
|
|
Define:EVIL PROGRAMMER (ē'vəl prō'grăm'ər)- n. An organism that converts caffeine into evil software. ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 1,020 Joined: 25-September 05 From: L.A. Member No.: 12,251 |
Try adding this to your span tag:
CODE <span id='general_total' style="display:inline">0</span> (either change the quotes to single quotes or escape them out if you are going to use that echo statement) I hope this fixes it |
|
|
|
Dec 9 2007, 09:19 PM
Post
#5
|
|
|
|||[ n00b King ]||| ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: [HOSTED] Posts: 681 Joined: 20-June 07 From: Auckland Member No.: 45,102 |
sorry for late reply. I already went with just full div reload and I dont have my previous versions of it backed up to test out ; ; . This does look like it will work though ajax is whacked in messing up displays I remember I had similar problems in the past and putting inline styles did work to some extent. If anyone is working with sometime similar try what alex pointed out. If I do come across this bridge again i will probbaly give it another go.
heres my final merit system now http://sonesay.trap17.com/char.php I probably wont do any more work on there It was only ment to be a test for my database structure and its seems sufficent enough to support my queries so right now i'm just working on template for my site layout after that its on to bulding my linkshell management system |
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
|
Lo-Fi Version | Time is now: 6th September 2008 - 05:19 PM |