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?
Alles anzeigen
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
- function ajaxFunction(){
- var ajaxRequest; // The variable that makes Ajax possible!
- try{
- // Opera 8.0+, Firefox, Safari
- ajaxRequest = new XMLHttpRequest();
- } catch (e){
- // Internet Explorer Browsers
- try{
- ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try{
- ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e){
- // Something went wrong
- alert("Your browser broke!");
- return false;
- }
- }
- }
- return ajaxRequest;
- }
- function showData() {
- //alert("i m here");
- htmlRequest = ajaxFunction();
- if (htmlRequest==null){ // If it cannot create a new Xmlhttp object.
- alert ("Browser does not support HTTP Request"); // Alert Them!
- return; // Returns.
- } // End If.
- htmlRequest.onreadystatechange = function(){
- if(htmlRequest.readyState == 4){
- document.getElementById("onlinearea").innerHTML = htmlRequest.responseText;
- var obj = document.getElementById('onlinearea');
- }
- }
- htmlRequest.open("GET", "index.php?mode=shoutbox", true);
- htmlRequest.send(null);
- }
- showData();
- setInterval("showData()",1000);
- function saveData(){ // This is our SaveData function, we will use this to send data to the database.
- htmlRequest = ajaxFunction();
- //alert(htmlRequest);
- if (htmlRequest==null){ // If it cannot create a new Xmlhttp object.
- alert ("Browser does not support HTTP Request"); // Alert Them!
- return; // Returns.
- } // End If.
- if(document.shoutbox.shouter_comment.value == "" || document.shoutbox.shouter_comment.value == "NULL"){ // If one of the fields is left Blank.
- alert('Gebe eine Nachricht ein!'); // Alters the user they forgot a field
- return; // Stops the rest of the script.
- } // End If.
- htmlRequest.open('POST', 'index.php?mode=sendshout'); // Sends our shout to sendshout.php.
- htmlRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // This tells our browser that a form is being submitted.
- htmlRequest.send('&message='+document.shoutbox.shouter_comment.value); // Sends the data.
- document.shoutbox.shouter_comment.value = ''; // Updates the shout box’s text area to NULL.
- document.shoutbox.shouter_comment.focus(); // Focuses the text area.
- } // End Function.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von Fragz ()