![]() |
Need some Javascript help
1 Attachment(s)
I'm confused, what's supposed to happen with this page is:
You click on the "Done" link and it marks the task as done, that's fine with the first one but when you go to the next one you need to click it 2 or 3 times before it will work. :confused: It does the same in IE and Mozilla browsers... :help: I've attached the entire page as .txt which you'll need to rename to .html, the javascript is being generated server-side BTW. Thanks in advance to anyone can spot the error. |
Re: Need some Javascript help
1 Attachment(s)
It's the 'done' flip-flop variable, you need to have a flip-flop for each of the tasks, probably best to use an array here. Basically, when you click a done link, the value of 'done' flips over so you have to click twice the next time, once to get it back to the orignal status then again to mark as done.
|
Re: Need some Javascript help
I may be wrong here, but your execute function takes an if else, and you are assigning 1 to 0 and 0 to 1, this may be your problem, I have noticed that even the third element of Done works the exact same, so this may show why, you are haveing this problem, thats the only thing I can see.
ik |
Re: Need some Javascript help
Thanks guys. :D
So basically I should do this? Code:
function execute(id) { |
Re: Need some Javascript help
Quote:
|
Re: Need some Javascript help
Sorry I didn't even notice you attached the page. :blush:
It works now! :) Thanks. :tu: |
Re: Need some Javascript help
I need help with a related thing, I can't figure out how to pass the contents of the textarea into the script. :confused:
HTML: Quote:
Quote:
post_comments.php?record=1&comments= I'm sure there's something simple that I've overlooked. :help: |
Re: Need some Javascript help
At a quick glance it looks okay, the only thing that I can suggest is:
a) Close the form tag (sorry if you have, it's just not in the section you posted). b) Give the form a name/id |
Re: Need some Javascript help
Well, if you know the ID you don't need to pass the text in, it is unnesscessary. I tried to fix what you said, but getting the comments1 value outside the function makes javascript throw a hissy fit. It needs a document.getElementById around it anyway. Outside the function, it doesn't work, inside, it does. I can only see that there is a scope issue there somewhere.
I would just do: HTML section: Code:
onclick="post_comments(1);Code:
function post_comments(id) { |
Re: Need some Javascript help
Nice one! That works, thanks. :) :nworthy:
|
| All times are GMT +1. The time now is 17:37. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum