Jump to content

lofaifa

Members
  • Posts

    78
  • Joined

  • Last visited

    Never

Everything posted by lofaifa

  1. how can that error impact the server ? .. and how should i fix it ?
  2. the problem is not jumping from an input to another my main problem is changing direction of just the current line u want , the other text stays in the same direction for example where writing something in english (ltr) and i want to write some arabic (rtl) i start a new line and when i click a button javascript function create a new tag inside the whole div im writing in with different direction . the first line was ltr and in second line when u clicked the cursor change direction and u can write arabic rtl first line ltr second line rtl this is what i want this is the main div tag : <div id="question_text" class="question" contenteditable="true"></div> button to change direction : <input type="button" value="<-" onclick="change_direction()" /> the javascript function im trying to play with : function change_direction(){ var string=$('.question').html(); var long=string.length; var empty_jump=string.substr(long-4); var jump=string.substr(long-10); //to make sure if the user jumped the line before clicking the button if(jump==='<br></div>'||empty_jump==='<br>'||string===''){ var ha=string.substr(0,long-15); //when i return a new line inside div and display the html a new line means : <div><br></div> so i want it plus span to change direction $(".question").html(ha+"<span><div><br></div></span>"); //now i want the cursor to be inside <span><div></div></span> ... CODE ... } else{ } } the function is obv bad but i didnt find any alternative ! CSS : #question_text span{ direction:ltr; float:left; margin-left:15px; font-family:"Courier New", Courier, monospace; font-size:14px; } Default direction is rtl in my case !
  3. maybe i should give up trying to change direction of writing inside a div tag . three days with no result
  4. i want to set the cursor inside a span tag that is inside a div editor when its created and the user complete writing inside the span html : <input type="button" value="<-" onclick="change_direction()" /> <div id="question_text" class="question" contenteditable="true"> <span id="spon"></span> </div> javascript : function change_direction(){ var string=$('.question').html(); var empty_jump=string.substr(-4); var jump=string.substr(-10); if(jump==='<br></div>'||empty_jump==='<br>'||string===''){ $(".question").append("<span id='spon'></span>"); // want to set the cursor here !!!!! this doesnt work document.getElementById('spon').focus(); //this also $("#spon").focus(); } else{ //not changing anything } }
  5. i solved the other problem but im now in another html one .. when i insert the new span tag inside the original div tag it get the same direction and float of div (when im changing span attributes to rtl) <div id="question_text" class="question" contenteditable="true"> <span id="spon">test</span> </div> #question_text{ direction:rtl; text-align:right; } #question_text span{ direction:ltr; text-align:left; }
  6. there is a problem , i want to detect all html in my div tag when i was working with textarea tag i used this : var string=$(this).attr('value'); and its not working .. also this : var string=$(this).text(); doesnt display html just text and those : string=document.getElementById('question_text').innerHTML; string=$(this).html(); gives me back when the div is empty (or when i jump a line) : <div><br></div> (empty text) <div><br></div><div><br></div> (jumped a line whith nothing in first line) <div> tags is appearing everywhere
  7. nice man .. ill try this new stuff u said and ill let u know the result later thanks everyone for ur help !
  8. and if i want to send the data inside <div> via form .. it wont work
  9. if i did that , the whole text inside the text area will change direction .. and i dont want that (tried it) what i want is if ur writing ltr (as default) normaly , and u want to write some code , it will be ugly to switch all of the provious text to rtl , soo what i want is that the previous text remains in the same direction and when u click the button ur actual direction change not the previous one , its like i wanna open a div inside the textarea with the direction u want and i put u inside it until u finished and u click back and u get out of the tag , soo that u still can see texts in different directions as u want inside ur textarea before u submit . <textarea dir="rtl"> normal text <div dir="ltr"> text with diferrent direction </div> </textarea>
  10. i have a textarea and two buttons .. my goal is when a user clicks a button the writing direction change (to rtl) , and when he clicks the other button he go back to normal direction ltr , the problem is i cant apply html tags inside a textarea cuz everything is considered a text ! any idea on how to do it ?
  11. its related to javascript in fact . i want two button .. if you click on one the direction of writing inside the textarea changes .. and when u finished with writing in the current direction and u wanna go back to the normal direction u click and u go back <textarea dir="rtl"></textarea> is the normal and when u click a div tag with direction "ltr" or something appears to do the job . when u click the other button u get out of that tag to the normal case .
  12. textarea can send data also .. anyway im having the problem of making changes inside textarea .. i couldnt do that cuz textarea considers everything a test so if i write something like this <textarea><b>test</b></texterea> it wont work , it will display <b>test</b> soo i need something like textarea that let html tags work ! any advice ?
  13. sorry that was a mistake , i didnt mean to double post
  14. ..and its not working (i replaced <textarea> with <div> to apply some html tags inside it ) and this is my form : <form action="proc.php" method="post"> <div id="text" name="question_text" class="text" contenteditable="true"></div> </form> but when i submit some text the $_POST['question_text'] is not set !
  15. ..and its not working (i replaced <textarea> with <div> to apply some html tags inside it ) and this is my form : <form action="proc.php" method="post"> <div id="text" name="question_text" class="text" contenteditable="true"></div> </form> but when i submit some text the $_POST['question_text'] is not set !
  16. everything is a text , this is my probem ! <textarea id="question_text" class="question" name="question_text"> <b>hey</b> <i>test</i> </textarea>
  17. i want to do some instant coloring when the user click a button but when i used .html() method or anything else the tags just appear without any effect .. how to make the same effect of tags inside textarea tag ??
  18. i tried with join yesterday man and it cuzed problems and i just give up when i tried this , join adds the tables together and the result is a lot of repeated things that i dont want !
  19. question of perfomance .. //take the names from table1 apply($sql1); foreach($names as $name){ //grab other info about the current user from table2 apply($sql2); } is this fine ?
  20. I Basically never did it before , i tried to add those two together $sql1="SELECT * FROM questions WHERE post_num_reporters<>0 ORDER BY post_num_reporters DESC , post_date ASC"; $sql2="SELECT * FROM answers WHERE post_num_reporters<>0 ORDER BY post_num_reporters DESC , post_date ASC"; soo they have they same columns names required , i tried this : $sql="SELECT * FROM questions,answers WHERE post_num_reporters<>0 ORDER BY post_num_reporters DESC , post_date ASC"; and it didnt work , whats the solution ??
  21. - the user is about to login and $_SESSION['last_ip'] is not set yet , soo we gonna set it if(isset($_SESSION['last_ip'])===false){ $_SESSION['last_ip']=$_SERVER['REMOTE_ADDR']; } - the user is browsing the site with the same ip adresse neither of those lines will run //cuz we already set his $_SESSION['last_ip'] when he logged in ($_SESSION['last_ip'])===false)==false ; //cuz hes still in the same computer = same IP ($_SESSION['last_ip']!==$_SERVER['REMOTE_ADDR'])==false; - now someone from another computer gonna try to access the same account and now the second part will run if($_SESSION['last_ip']!==$_SERVER['REMOTE_ADDR']){ session_unset(); session_destroy(); } cuz $_SESSION value is stored in the server .. ?
  22. i want to kick anyone whos trying to connect from an account whos already online ..
  23. i have a <div id="rating"><a></div> tag styled and i wanna change the css of it (<a>) #rating a{ font-size:11px; font-family: arial; text-decoration:none; text-align:center; display:block; height:10px; float:left; width:10px; border: /*#B48B89*/ #666 1px solid; padding:0 4px 5px 4px; margin-right:5px; border-radius:2px; backgroud-color:#fff; } i want to change the background-color and i dont know how to point out to #rating a .. (using javascript or jquery)
  24. which is the best place to put this code : if(isset($_SESSION['last_ip'])===false){ $_SESSION['last_ip']=$_SERVER['REMOTE_ADDR']; } if($_SESSION['last_ip']!==$_SERVER['REMOTE_ADDR']){ session_unset(); session_destroy(); } like this : class session { public $user_on=false; public $user_id; function __construct(){ //make sure that javascript can not access session variable ini_set('session.cookie_httponly',true); session_start(); //set the last ip the user has logged on with if(isset($_SESSION['last_ip'])===false){ $_SESSION['last_ip']=$_SERVER['REMOTE_ADDR']; } if($_SESSION['last_ip']!==$_SERVER['REMOTE_ADDR']){ session_unset(); session_destroy(); } $this->check_login(); } private function check_login(){ if(isset($_SESSION['user_id'])){ global $user; $this->user_id=$_SESSION['user_id']; $this->user_on=true; $user->find_by_id($this->user_id); } else { unset($this->user_id); $this->user_on=false; } } } OR : function __construct(){ //make sure that javascript can not access session variable ini_set('session.cookie_httponly',true); session_start(); $this->check_login(); } private function check_login(){ if(isset($_SESSION['user_id'])){ global $user; [b]//set the last ip the user has logged on with if(isset($_SESSION['last_ip'])===false){ $_SESSION['last_ip']=$_SERVER['REMOTE_ADDR']; } if($_SESSION['last_ip']!==$_SERVER['REMOTE_ADDR']){ session_unset(); session_destroy(); }[/b] elseif($_SESSION['last_ip']===$_SERVER['REMOTE_ADDR']){ $this->user_id=$_SESSION['user_id']; $this->user_on=true; $user->find_by_id($this->user_id); } } else { unset($this->user_id); $this->user_on=false; } } }
  25. thank u ..
×
×
  • 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.