Jump to content

seanlim

Members
  • Posts

    355
  • Joined

  • Last visited

Everything posted by seanlim

  1. If there is reason for you to use the style attribute, you have to do element = $(element)[0];
  2. Why would you want to use the style attribute? Since you already have JQuery object, isn't it more convenient to use $(element).css('opacity', ...);
  3. Any example page? I plugged your HTML code and JQuery into a page and everything works, after changing "display:none" to "display:block" and using $("#freetext").val(). Note the #freetext. It is probably something else on the page that is causing the unexpected behaviour if using the ID selector still does not solve the issue.
  4. Yes... my bad! Sorry about that. As mikesta707 pointed out, you will have to note the return values, but I believe it would still work if you compared them correctly. Anyway, I think it would be more secure and efficient to store the username and a hash of the password in a database.
  5. try removing the <style> tags, they aren't needed when in an external css file.
  6. i think it is possible to change the entire stylesheet i.e. using $("link[rel=stylesheet]").attr('href', 'newstyleshee');
  7. i meant including the hash sign in front as in ID selector...
  8. If it's just a matter of displaying 0 when the $currentbalance drops below 0, use $currentbalance = max($row['totalpaid'] - $row['points'], 0); But more importantly, why would the points be negative in the first place? Is your calculations correct?
  9. Try <param name="movie" value="<?php echo $url; ?>" /> and <embed src="<?php echo $url; ?>" type="application/x-shockwave-flash" bgcolor="#000000" allowfullscreen="true" allowscriptaccess="always" width="416" wmode="transparent" height="374">
  10. I don't think that's right. That only leaves out the first friend from the list if i'm not mistaken. Edit: To rephrase, it displays the entire members list minus the first friend that it finds on the list.
  11. Assuming that (1) your members table has the column members.id and (2) your friends table consists of the columns friends.member_id and friends.friend_id referencing the member's id and the friend's respectively SELECT * FROM members LEFT OUTER JOIN friends ON members.id=friend_id AND friends.member_id="[Currently Logged In User's ID]" Members who are not friends will have null values for the joined `friends` columns Members who are friends will have their member ids displayed in the joined `friends` columns Hopefully I make sense
  12. You're welcome! Looking at it again, it might be sufficient to do window.onload = function(){get_results('');}; if you are always expecting the search field to be empty and want to display all the results when the page loads.
  13. Use strcmp instead of == if (strcmp($form_user, $user) && strcmp($form_password, $password)) And use $_POST['password'] instead of $_POST[password], $_POST['username'] instead of $_POST[username]
  14. Add this somewhere within your script tags: window.onload = function(){get_results(document.getElementById("search").value);};
  15. What is your HTML structure like? I would think that you will need a $("#ajax-quote-form").hide() or something similar.
  16. Fix up these errors first before we try to figure out what's wrong: [*]ereg is deprecated [*]use <?php instead of <? [*]test for presence of $_POST['email'] & $_POST['name'] before using [*]set $error['email'] = false; before validating, similar to what you did for $error['name'] [*]instead of sendMail(($_POST['msg']).($_POST['email'])); try replacing the comma (,) with a period (.)
  17. Yes, it's possible. Go read up a little on manipulating DOM with Javascript. <script type="text/javascript"> function showMessageArea(link) { var message_area = document.getElementById('message_area'); message_area.parentNode.removeChild(message_area); link.parentNode.insertBefore(message_area, link.nextSibling); message_area.style.display="block"; } </script> <style type="text/css"> a{display:block} </style> <a href="#" onclick="showMessageArea(this); return false;">Link1</a> <a href="#" onclick="showMessageArea(this);return false;">Link2</a> <a href="#" onclick="showMessageArea(this); return false;">Link3</a> <form id="message_area" style="display:none"> <textarea rows="10" cols="20" name="message"></textarea> <input type="submit" name="submit"> </form>
  18. It is the same type of loop, but you are basically looping over a different set of elements. In your original, you were looping over all the childrenNodes of xml.getElementsByTagName("fruits")[0], which included text nodes and other what-nots, including children elements without <fruit> tags. If I have a <citrous> element under <fruits>, the original piece of code will also be able to access the <citrous> element. In your new piece of code, you are specifically looking for elements with the tag "fruit". This is probably faster if you simply want to find only elements with the <fruit> tag. PS: Do remember to mark the topic as "Solved" too!
  19. You currently have 2 email formats: The first shows all the fields (email, name phone) and their values, and is currently sent to the webmaster. I'll assume that this is correct and require no further changes. The second displays the message "Thank you for your interest! Your email will be answered very soon!", and is sent to the email address stored in the variable $recipient. This format is also displayed in the browser because you do have an echo "$theReply"; at the bottom. Now, I'll assume that this second message is the same one that "(lets) them know that the order has been sent after the submit button". And where is the code/text for the "email to let them know that they will receive an order confirmation"? Will this email be sent at the same time as the previous email? Do let me know if my assumptions are wrong.
  20. Yes, JS is the route to go. However, in your script, you seem to be mixing up JS and PHP. A stripped down version of what you are trying to achieve is this: <a href="#" onclick="document.getElementById('message_area').style.display='block'; return false;">Link</a> <form id="message_area" style="display:none"> <textarea rows="10" cols="20" name="message"></textarea> <input type="submit" name="submit"> </form> I'm not 100% certain if all browsers especially the older ones support the use of the style attribute (haven't used it in awhile), but the general idea is there. Should be able to get you started at least.
  21. Hi helloise, if the link was clicked, i call my JS and set return value = 1 then i check if $was_clicked ==1 if it is i display textarea and a submit button Your Javascript code won't be able to interact/pass variables to PHP, apart from generating another HTTP request e.g. through Ajax. I can't make any sense of your coding logic, but from what I see, there 2 key problems: 1. $was_clicked is never changed throughout your script. It was declared 0 and will always be zero, rendering your if statement useless. Basically, the if block testing for $was_clicked==1 will never run. 2. Because you set val = 1, and immediately return val, return sendMessage() will ALWAYS return 1, causing the link to be followed through (albeit to "#") Hopefully this will help you figure out where you are going wrong with your logic. Otherwise, please describe what you are trying to achieve, and explain how you know that your "JS is not executing".
  22. Try using document.getElementsByTagName? var e = document.getElementsByTagName('input'); for(var i=0; i<e.length; i++) { if(e[i].type == 'text') e[i].setAttribute('autocomplete', 'off'); };
  23. Yep, agreed. array_count_values is definitely more efficient. Cheers mate
  24. Okay, I just pulled an all-nighter so my mind's all fudged up... sorry if my logic's screwed, but I still don't see how it will always be true! <?php $words = "foo,bar,test,foo"; $tagArray = $temp = array(); $temp = explode(',', $words); foreach($temp as $tag){ var_dump(!array_key_exists($tag, $tagArray)); if(!array_key_exists($tag, $tagArray)) $tagArray[$tag] = 0; $tagArray[trim($tag)]++; } print_r($tagArray); ?> Output: bool(true) bool(true) bool(true) bool(false) Array ( [foo] => 2 [bar] => 1 [test] => 1 ) Maybe I misunderstand you?
×
×
  • 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.