Jump to content

shortysbest

Members
  • Posts

    414
  • Joined

  • Last visited

Everything posted by shortysbest

  1. That exact code that you just gave me doesn't work for my safari.. :| I have safari 5.0.3
  2. Nothing happens, in either firefox nor Internet Explorer, and it's not just the body element it doesn't work on, I was just using this as an example, What I have it for is for the button to login and sign up, as well as with other stuff.
  3. www.kithell.com (the pink areas in Safari are where there should be a background image, which you can see if you view it in firefox)
  4. concerning the alt="" tag for the image element, I have that in my code for my site, and even that doesn't show up in safari. In response to the css code, this would be the css I am using for the two black buttons (black in firefox, white in safari), along with the active image for the buttons (which show and everything when you click on the buttons) .button { background-image: url(../assets/buttons.png); background-repeat: repeat-x; color: #FFF; border: 1px solid #000; padding-top: 5px; padding-right: 12px; padding-bottom: 5px; padding-left: 12px; cursor: pointer; font-family: Verdana, Geneva, sans-serif; font-size: 11px; text-decoration: none; background-position: top; text-align: center; display: block; background-color: #333; } .button:active , .share:active{ background-image: url(../assets/navigationback-active.png); background-repeat: repeat-x; }
  5. alright, yeah I made an entirely new site, and I took the latest Jquery framework off of their site and tested this page with it, again worked fine in firefox, but not in IE9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" src="jquery.js"></script> </head> <body> <script> $(document).ready(function(){ $(document).click(function(){ alert('a'); }); }); </script> </body> </html>
  6. Yeah, I know it worked in IE 8, but it doesn't work in all versions, like the new IE 9 Beta, and older versions older then 8 (not sure exactly which ones though)
  7. Well, the #login instance was just an example of how I am using jquery click(), the fact is that click() doesn't work at all in certain versions of IE
  8. Oh, I know that, the page I tested it on had a good amount of body space on it, it wasn't blank, and my point was that it worked in firefox, but not in IE (when clicking inside body) (and also, that code you just gave me works in firefox but not in IE.)
  9. The code I just posted above is a completely separate piece of code, it has nothing to do with the login. I used that for a clean simple test to check whether or not it was a piece of my code, or just the jquery click() that wasn't working in IE. I posted the version of IE that I am using that it does not work in, I know I had this issue on older versions of IE as well, on older computers at school, but it worked fine on my computer which had IE 8.
  10. I just have $(document).ready(function(){ $("body").click(function(){ alert('a'); }); }); and it doesn't work in IE, it does however work in firefox/safari.
  11. why doesn't the jquery click() work in IE? Well, not all versions of IE, there were some versions it worked, now I have the newest version (9.0.7930.16406), and older some of the older versions do not work either. this is how I do it: $(document).ready(function(){ $("#login").click(function(){ //code to execute here }); });
  12. I attached a photo of what's going on. on the left is Safari, and the right is Firefox. Even just images aren't loading. such as: <img src="assets/logo.png" /> If i set the size on it however it shows a big white box for the size that it is defined. The same problem with background images, and I'm using this css for background images: background-image: url(../assets/buttons.png); (the ../ does have to be there, it's not that). background images do show for like :hover and :active and such, just not when you load the page. (images are on in safari preferences). this same problem is safari and chrome. [attachment deleted by admin]
  13. How could I split a string in half but not in the middle of a word? $information = "This is the string of text, however at some point in the sentence a word may get split in half."; $cut = round(strlen($information)/2); ///where to cut (50%) $split1 = substr($information, 0, $cut); //first half $split2 = substr($information, $cut); // second half
  14. I have a large amount of text, (text can be different at any time), I count the number of characters in the string,and divide it by 2 so that half of the text will be in one variable, the other half in the other, however I am not sure how to get the split function, or whichever function to split it by the number of characters. example: $text = "lorem ispum dolar sit amet, consecterur adiscing elit. Donec dictum placerat sapien, in eliefend liber"; $cut = strlen($text)/2; //(here's where i cannot get it to work/do not know which function to use and how to use it) //but what I want it to do is to split it half way.
  15. Okay, yeah I understand that I can only return Jason data back to the Ajax for that to work, however in this case I can't only send the Json data back, I have to send all the other code back for it to output the new post once posted. I have gone away from using the Json method for this, I am just assigned a javascript variable on the php page and when it returns the data to Ajax I can call those variables to get the information I need. This is how I'm doing it now: Ajax, function profile_post(){ var o_post = $("#profile-post").val(); var id = get('id'); var post = o_post.replace(/^\s+|\s+$/g, '') ; if($('.profile-post-button').attr('id')=="active") { if(post) { $('.profile-post-button').attr('id', 'inactive'); $.ajax({ type: "POST", url: "ajaxpages/add_post.php", data: "id="+id+"&post="+post, cache: false, success: function(html){ $("#profile-post").val(''); $("#profile-post").addClass("profile-post"); $(".post-stream").prepend(html); $(".post-stream li").slideDown("fast"); $("#posterror-1, #posterror-3").fadeOut("fast"); $('.profile-post-button').attr('id', 'active'); if(new_post&&last_post_id) { $(".last-post").fadeOut("fast", function(){$(".last-post").html(new_post)}); $(".last-post").fadeIn('fast'); $(".last-post-time").fadeOut("fast", function(){$(".last-post-time").html("a few seconds ago")}); $(".last-post-time").fadeIn('fast'); $(".last-post-time").attr("id", last_post_id); } } }); } } } PHP, <?php error_reporting(0); include("../includes.php"); $session = $_COOKIE['id']; $db_uid = $_POST['id']; $db_post = mysql_real_escape_string($_POST['post']); $db_date = mktime(); $check_post = $db_post; preg_match( "`((http)+(s)?:(//)|(www\.))((\w|\.|\-|_)+)(/)?(\S+)?`i", $check_post, $does_link_exist); $link_exists = $does_link_exist[0]; if($link_exists) { $type = 1;//link } else { $type = 0;//status } mysql_query("INSERT INTO posts SET to_id='$db_uid',from_id='$session',post='$db_post',type='$type',date='$db_date'"); $id = mysql_insert_id(); if($db_uid!=$session) { mysql_query("INSERT INTO notifications VALUES('','$db_uid','$session','$type','$id','','$db_date')"); } $get_post = mysql_fetch_assoc(mysql_query("SELECT * FROM posts WHERE id='$id'")); ?> <li id="post<?php print $id?>" style="display:none;"><?php include("post_page.php");?></li> <?php if($type==0&&$db_uid==$session) { ?> <script> var last_post_id = <?php print $id?>; var new_post = "<?php print truncate($db_post, 50);?>"; </script> <?php } else { ?> <script> var last_post_id = null; var new_post = null; </script> <?php }?>
  16. I'm not sure if I understand exactly what you mean. Are you talking about the returning the Json data to ajax from the php page? That it has to JUST return the Json data for ajax to get the data from that?
  17. create an account and sign in. http://www.kithell.com When you sign in go to your profile, and add a post. Now, once you click the "Share" button it prints the data (status, date, photo, everything else) That PHP page, and Ajax code controls the whole process that is done when you click on the Share button.
  18. I see, well I would need a way to be able to print data, and send information back to the jquery. However I did come up with the only solution I could think of, defining the variables in the bottom of the php file and that way it the javascript variables can be used for that. If you have a better way of doing this please let me know, if not thanks for the help you have given.
  19. Javascript: function profile_post(){ var o_post = $("#profile-post").val(); var id = get('id'); var post = o_post.replace(/^\s+|\s+$/g, '') ; if($('.profile-post-button').attr('id')=="active") { if(post) { $('.profile-post-button').attr('id', 'inactive'); $.ajax({ type: "POST", url: "ajaxpages/add_post.php", data: "id="+id+"&post="+post, cache: false, success: function(html){ $("#profile-post").val(''); $("#profile-post").addClass("profile-post"); $(".post-stream").prepend(html); $(".post-stream li").slideDown("fast"); $("#posterror-1, #posterror-3").fadeOut("fast"); $('.profile-post-button').attr('id', 'active'); $(".last-post").fadeOut("fast", function(){$(".last-post").html(post)}); $(".last-post").fadeIn('fast'); var post_id = html.postid; alert(post_id); } }); } } } PHP: <?php error_reporting(0); include("../includes.php"); $session = $_COOKIE['id']; $db_uid = $_POST['id']; $db_post = mysql_real_escape_string($_POST['post']); $db_date = mktime(); $check_post = $db_post; preg_match( "`((http)+(s)?:(//)|(www\.))((\w|\.|\-|_)+)(/)?(\S+)?`i", $check_post, $does_link_exist); $link_exists = $does_link_exist[0]; if($link_exists) { $type = 1;//link } else { $type = 0;//status } mysql_query("INSERT INTO posts SET to_id='$db_uid',from_id='$session',post='$db_post',type='$type',date='$db_date'"); $id = mysql_insert_id(); print json_encode(array('postid' => $id)); if($db_uid!=$session) { mysql_query("INSERT INTO notifications VALUES('','$db_uid','$session','$type','$id','','$db_date')"); } $get_post = mysql_fetch_assoc(mysql_query("SELECT * FROM posts WHERE id='$id'")); ?> <li id="<?php print $id?>" style="display:none;"><?php include("post_page.php");?></li>
  20. I know that the code is working because in the ajax success code I have the html return the html from my php page print the json_encode line that returns the array and it prints the correct code in this format: {"postid":178} 178 being the id of the post.
  21. mysql_query("INSERT INTO posts SET to_id='$db_uid',from_id='$session',post='$db_post',type='$type',date='$db_date'"); $id = mysql_insert_id(); echo json_encode(array('postid' => $id)); function profile_post(){ var o_post = $("#profile-post").val(); var id = get('id'); var post = o_post.replace(/^\s+|\s+$/g, '') ; $('.profile-post-button').attr('id', 'inactive'); $.ajax({ type: "POST", url: "ajaxpages/add_post.php", data: "id="+id+"&post="+post, cache: false, success: function(html){ var post_id = html.postid; alert(post_id); } }); } That's the cut down version.
  22. Thank you, however this doesn't seem to be working. It does output this from php: {"postid":178} however when i try to alert the variable from javascript it says undefined. var post_id = html.postid; alert(post_id);
  23. How could I return a variable from php in the success part of ajax jquery? This would be like what my php page would look like (which the ajax code refers to): $id = $_POST['id']; //code that would run here for whatever //Then here is where I want to send a value back to the success of the ajax below $variable_to_return = 'abc'; This is what I'm using for ajax: function post() { var id = get('id'); $.ajax({ type: "POST", url: "add_post.php", data: "id="+id, cache: false, success: function(html){ //I need to have an html function for some code to be returned. //and I want $variable_to_return to be put into a javascript variable: var variable_returned_from_php = 'abc'; } }); } }
  24. Is there anyway I can like "exit" the variables so i can use the same variable name later in the page?
  25. I've seen this done, when you have a title or something for whatever it may be if there is more than 1 line of text the text gets smaller than the regular size. Or when you're typing in a box and you type more than the box can hold the text size decreases.
×
×
  • 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.