Seite springt automatisch zur Shoutbox

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Seite springt automatisch zur Shoutbox

    Hallo,

    Ich habe gerade in meinem Forum die Shoutbox auf Ajax umgestellt und habe da ein kleines Porblem.
    Die Shoutbox hängt ziemlich weit Unten und wenn man die Seite aufruft springt er direkt in den Footer zur Shoutbox, so sollte es nicht sein.
    Anschauen könnt ihr das ganze hier selbsthilfepoint.info/index.php?mode=portal

    Wie kann ich dies verhindern?


    Quellcode

    1. function ajaxFunction(){
    2. var ajaxRequest; // The variable that makes Ajax possible!
    3. try{
    4. // Opera 8.0+, Firefox, Safari
    5. ajaxRequest = new XMLHttpRequest();
    6. } catch (e){
    7. // Internet Explorer Browsers
    8. try{
    9. ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    10. } catch (e) {
    11. try{
    12. ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
    13. } catch (e){
    14. // Something went wrong
    15. alert("Your browser broke!");
    16. return false;
    17. }
    18. }
    19. }
    20. return ajaxRequest;
    21. }
    22. function showData() {
    23. //alert("i m here");
    24. htmlRequest = ajaxFunction();
    25. if (htmlRequest==null){ // If it cannot create a new Xmlhttp object.
    26. alert ("Browser does not support HTTP Request"); // Alert Them!
    27. return; // Returns.
    28. } // End If.
    29. htmlRequest.onreadystatechange = function(){
    30. if(htmlRequest.readyState == 4){
    31. document.getElementById("onlinearea").innerHTML = htmlRequest.responseText;
    32. var obj = document.getElementById('onlinearea');
    33. }
    34. }
    35. htmlRequest.open("GET", "index.php?mode=shoutbox", true);
    36. htmlRequest.send(null);
    37. }
    38. showData();
    39. setInterval("showData()",1000);
    40. function saveData(){ // This is our SaveData function, we will use this to send data to the database.
    41. htmlRequest = ajaxFunction();
    42. //alert(htmlRequest);
    43. if (htmlRequest==null){ // If it cannot create a new Xmlhttp object.
    44. alert ("Browser does not support HTTP Request"); // Alert Them!
    45. return; // Returns.
    46. } // End If.
    47. if(document.shoutbox.shouter_comment.value == "" || document.shoutbox.shouter_comment.value == "NULL"){ // If one of the fields is left Blank.
    48. alert('Gebe eine Nachricht ein!'); // Alters the user they forgot a field
    49. return; // Stops the rest of the script.
    50. } // End If.
    51. htmlRequest.open('POST', 'index.php?mode=sendshout'); // Sends our shout to sendshout.php.
    52. htmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // This tells our browser that a form is being submitted.
    53. htmlRequest.send('&message='+document.shoutbox.shouter_comment.value); // Sends the data.
    54. document.shoutbox.shouter_comment.value = ''; // Updates the shout box’s text area to NULL.
    55. document.shoutbox.shouter_comment.focus(); // Focuses the text area.
    56. } // End Function.
    Alles anzeigen

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Fragz ()

  • Hallo,

    Praktisch in jedem Broeser passiert dies.

    Das hier wäre der passende HTML Teil

    Quellcode

    1. <form id="shout" name="shoutbox" method="POST" onsubmit="saveData(); return false;">
    2. <strong>{$LANG.MESSAGE}:</strong> <input name="shouter_comment" id="message" type="text" class="input" style="width:500px;" autofocus /> &nbsp;&nbsp;
    3. </form>
    4. <div id="onlinearea">
    5. </div>