help me plzzzzzzz!!!need ur help immediately...

Discussion in 'JavaScript' started by anitha_bingo, Nov 26, 2007.

  1. #1
    hi pals
    i'm doing chat project using .net ... i use frames to show all the pages like(type_msg- where we type message , message-where the messages will be displayed ,user_in_chatroom- this pages displays the chat users who are in online) using db(access) i retrieve all those information needed .......
    everthing is working fine........
    except the message page ..i use refresh script inorder to refresh the message ......evertime it get refreshed the cursor goes to the top of the page .....
    i need the cursor to be at the end of the line entered last after freshing
    i dont know whether it will work using scripting ... :confused:
    but please help me......give ur hands so thst i can raise up
    waiting for ur honourable reply
    :)
     
    anitha_bingo, Nov 26, 2007 IP
  2. tarview

    tarview Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This might help. I found it on faqts.com (go here: tinyurl(dot)com/emuoa)

    <SCRIPT>
    function setCaretToEnd (el) {
      if (el.createTextRange) {
        var v = el.value;
        var r = el.createTextRange();
        r.moveStart('character', v.length);
        r.select();
      }
    }
    function insertAtEnd (el, txt) {
      el.value += txt;
      setCaretToEnd (el);
    }
    </SCRIPT>
    Code (markup):
     
    tarview, Nov 26, 2007 IP
  3. anitha_bingo

    anitha_bingo Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    B]thank you tarview :p
    [but its not working while i use a refreshing script:(
    (actually i have written an automatic refreshing script ..if i use this refreshing script that automatic scrolling is not working ...if i dont use that refeshing script that page working with your idea)
    but i need the page to scroll automatically after refreshing :(
    do you have any other idea????
    i'm sorry for my english
    please help me!!!!!!!![/B]
     
    anitha_bingo, Nov 27, 2007 IP
  4. anitha_bingo

    anitha_bingo Peon

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    its an automatic refresh .

    here's the script that i use for automatic refreshing :

    <script type="text/javascript">

    function reFresh() {
    location.reload(true)
    }
    window.setInterval("reFresh()",3000);
    </script>
    i'm doing a public chat project :i use frameset and called the following webpage user.aspx,type_message.aspx,message.aspx
    in user.aspx -shows the number of online user's in the chat room
    type_message.aspx-here the user types his messages here
    message.aspx-in message.aspx,i use automatic refreshing and need this page to scroll automatically as soon as i enter the text message .this page displays the chat message in public .....
    everything is working fine except scrolling
    As it is refreshing after each 3000 millisec the scroller goes to the top of the page
    i need the scroller to be at the bottom of the page
     
    anitha_bingo, Nov 28, 2007 IP
  5. tarview

    tarview Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    The code should go in message.aspx. Have it run the function on page load. And, I believe you only need the setCaretToEnd function, not the other one.

    It should work. I'll do some testing and let you know what I come up with.
     
    tarview, Nov 28, 2007 IP