Jump to content

aooga

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Everything posted by aooga

  1. Ok I learnt some jQuery, I don't know if it helped. Here's my function: function edituserquestion(questionid, action) { $.post( "index_edituserquestion.php", {questionid: questionid, action: action}, function(xml) { qid = $("questionid", xml).text(); questiontype = $("questiontype", xml).text(); fedituserquestion(qid, questiontype); refreshnreviewnow(); refreshreviewquestions(); } ); } So when I click one one question, calling edituserquestion(30), and quickly click on edituserquestion(20), only edituserquestion(20)'s response is registered. I don't know how to convert this to use global variables. What should I do?
  2. I have a function --> function edituserquestion(questionid, action) { xmlHttp=GetXmlHttpObject();if (xmlHttp==null){alert ("Browser does not support HTTP Request");return;} ...} which calls --> function stateChangededituserquestion() {...} How can I make it that if the user clicks one a button with questionid 5, and before stateChangededituserquestion returns from the server the user clicks on another button with a different questionid, it'll work fine (i.e. the server will process one after the other and my script will deal with them in order?)
  3. HTML: <span id="top"> <span id="bottom"> </span> </span> If my javascript script starts with "bottom", is there a function to get it's immediate ancestor, in this case "top"?
  4. Didn't work for me: now I get '%u05D0' <script type="text/javascript"> function process() { input = document.getElementById("input").value; url = "test2.php"; url += "?input=" + escape(input); window.location.href = url; } </script> <form action='test2.php' method='post'> <textarea id = 'input' name = "input"></textarea> <input type="submit" value="Click here to POST" /> </form> <a href="javascript:process()">Click here to GET</a> <?php $input2 = $_POST['input']; $input = $_GET['input']; $input = urldecode($input); echo $input; echo $input2; ?>
  5. I have a textbox where the user inputs data which is sent to another php file. When the user types in hebrew, it is transferred correctly with POST but not with GET. With POST I get א (the correct input) and with GET I get ×. How can I get it to work with GET? I've isolated the problem to as little code as I can (the actual application uses ajax), here it is: test.php: <script type="text/javascript"> function process() { input = document.getElementById("input").value; url = "test2.php"; url += "?input=" + input; window.location.href = url; } </script> <form action='test2.php' method='post'> <textarea id = 'input' name = "input"></textarea> <input type="submit" value="Click here to POST" /> </form> <a href="javascript:process()">Click here to GET</a> test2.php just gets the get or post. <?php $input2 = $_POST['input']; $input = $_GET['input']; echo $input; echo $input2; ?>
  6. Okay, I suppose I will. It just seems so inelegant. And I suppose in theory, with enough edits, it could bog down performance. But I suppose it's very unlikely to ever reach that point.
  7. I've written a website with php where there are questions arranged as a linked list. I want to convert it to javascript and ajax. There will be default question, the ability to add and delete them etc. So for instead if I start with: <span id='1'>1</span> <span id='2'>2</span> I want to be able to add 1.5 and then delete 1. How do I create 1.5? If I put it right after 1 i.e. <span id='1'>1 <span id='1.5'>1.5</span></span>, then deleting 1 will delete 1.5 too. What should I do? Right now my best idea is rename <span id='1'> to <span id='blah'> and then innerHTML in it <span id='1'> and <span id='2'>, then rename blah to junk. But then after many modifications my page will filled with a bunch of 'junk' spans.
  8. Would removechild remove the elements within the element? is there a way to replace <p id='1'></p> with <p id='1.1'></p> <p id='1.2'></p> ?
  9. If my script will be creating and deleteing spans constantly, is there a way to delete the span itself or do I just have to keep it empty and change it's id to 'empty' or something? Eg.: <span id='1'>1</span> <span id='2'>2</span> Then a function creates 2.1 and 2.2 within span id='2': <span id='2'><span id='2.1'></span><span id='2.2'></span></span> Is there a way to get rid of <span id='2'>?
  10. I've made the code as small as possible to isolate the problem, but this should be enough to demonstrate it. When I click on 1, 2 or 3 then 2 becomes a. Then when I click on a, 3 becomes hello, but b does not become hello. I'm at a loss as to why. Btw: if function a() { document.getElementById('2').innerHTML = "<p onclick='b()'>a</p>"; document.getElementById('2').innerHTML = "hello"; } this would work. It's only if document.getElementById('2').innerHTML = "hello"; is in b() that it doesn't. I'm REALLY curious about this, what am I missing?
  11. <script type="text/javascript"> function a() { document.getElementById('2').innerHTML = "<p onclick='b()'>a</p>"; } function b() { document.getElementById('2').innerHTML = "hello"; // this doesn't work document.getElementById('3').innerHTML = "hello"; // this does } </script> <p id='1' onclick='a()'>1</p> <p id='2' onclick='a()'>2</p> <p id='3' onclick='a()'>3</p>
  12. I want to start out with: <a onclick=somefunction>new number</a> <p onclick=somefunction>1</p> <a onclick=somefunction>new number</a> <p onclick=somefunction>2</p> <a onclick=somefunction>new number</a> <p onclick=somefunction>3</p> <a onclick=somefunction>new number</a> I want to be able to click on everything - on the new number to add a new number to the list, on 1 or 2 or 3 to delete a number from the list. And I'd like to be able to add 1.5, then delete 2 then add 2.5 etc. ending up with 1 1.5 2.5 3 This sounds arbitrary but it's essential for the webpage I've got in mind. Thank you!
  13. For example: http://hypermegaultra.com/editQuestions.php?#602 Note the ? at the begging of the sentence instead of the end.
  14. When I create a textbox to enter data into a database (and then display it back to me), if I write a ? after a word and then a space the ? shows up on the wrong side. Similar things with colon etc. Are there any more robust textboxes I can use instead of the stand input ones, or any other workaround? any free solutions? I suppose the ideal would be a simple and free rich text form. If I could get the gmail compose email form on my site that'd be great, it's a really robust form which works very well with right to left languages.
  15. I'm using php and Javascript together with AJAX. I want my php script to return 3 sets of data to my javascript function stateChanged(). I want some data to go into the innerHTML of document.getElementById("question"), some into document.getElementById("answer"), and some into document.getElementById("answer2"). Right now, the best way I can think of is to echo from within my php file: echo "<question>this is the question here</question>"; echo "<answer>this is the answer</answer>"; echo "<answer2>this is the answer2</answer2>"; and then use regular expressions within the javacript to parse the file and process it. Is there an easier way?
  16. Thank you, I think you've really hit the nail on the head as to what I was trying to do and what was wrong about it. Basically I know how to do very few things in javascript and am trying to hack my way into doing certain elementary things with what I know. I'm going to work more on this. Do you know of any good online resources for these types of things? W3schools sometimes seems kind of perfunctory... Anyways, thanks a whole bunch!
  17. I want to be able to click a button and display a whole bunch and then click another button and get display something else. It's not really working. Any tutorials / examples on doing something like this? The biggest problem I have is reproducing single ' and double " quotes effectively, there must be an easier way to do this! Thank you! Here's my code: <script type="text/javascript"> function newfirstquestion() { var x = "<p>Question:</p>"; x += '<textarea name = "question" rows="4" cols="80"></textarea>'; x += "<p>Answer:</p>"; x += '<textarea name = "answer" rows="4" cols="80"></textarea> <br />'; x += '<input type="submit" name="form" onclick="document.getElementById('; x += "'firstquestion').innerHTML=<span onclick="; x += '"document.getElementById('; x += "'firstquestion').innerHTML=newfirstquestion();"; x += '" id="firstquestion"><p>NEW FIRST QUESTION</p></span>'; x += ' | '; x += '<input type="submit" name="form" value="CANCEL" />'; return x; } </script> <span onclick=" document.getElementById('firstquestion').innerHTML=newfirstquestion(); " id="firstquestion"><p>NEW FIRST QUESTION</p></span>
  18. How to refer to DOM object in div classes (from my CSS)? When I click on the word Red it doesn't turn the background red, I'm assuming because of my css divs. What is the correct code? <body><div class="colmask leftmenu"><div class="colleft"> <div class="col1" align="center"> <span onclick="document.bgColor = 'red';">Red</span> </div></div></div></body> As for the divs, I'm copying the layout from http://matthewjamestaylor.com/blog/ultim... So my main content is in a div. The script works fine without the div, I think it's just a matter of - instead of document.bgcolor, document.div.div.bgcolor or something like that. Any ideas?
  19. Is there a function / constant to find out where the user is coming from, so I could make a link to go back which changes depending on where the user is coming from?
  20. if I have a table CONTENT with a primary key of contentID. Then I have 6 other tables with a foreign key to contentID - SUBJECTS, BOOKS, DIVIDES, CHAPTERS, QUESTIONS, NOTES. Should I 1) make a field in CONTENT called contentType with keys Su, Bo, Di, Ch, Qu, No. Or 2) find out what the contentType is in the php script? What do you recommend? If I should do 2), what is the best way to do it?
  21. I've been using cookies on my server for awhile, then I was upgrading and dumped my previous version into a folder 0.1 so now I access it at localhost/0.1/ and suddenly my logout script doesn't work anymore function logout(){ $past = time() - 100; setcookie('ID', gone, $past); setcookie('Key', gone, $past); } Now everytime I log out a new ID cookie is created. It seems setcookie can create cookies in path 0.1 but doesn't find them to edit them?
  22. Here's a simpler way of presenting it: $nextRep = "2000-01-01"; echo $nextRep; // 2000-01-01 echo "<br>"; $nextRep = strtotime($nextRep); echo $nextRep; // 946677600 echo "<br>"; $nextRep = date("o-m-d", $nextRep); echo ($nextRep); // 1999-01-01 echo "<br>"; $nextRep = strtotime($nextRep); echo $nextRep; // 915141600
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.