Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    Aug 2004
    Location
    UK
    Posts
    11,283
    Tokens
    2,031

    Latest Awards:

    Default Anyone good with ajax/ javascript?

    Basicaly my ajax news system for tb5 works perfectly in firefox but ****s up in IE. As i cant realy be arsed to hunt aorund for hours looking for whats wrong, when chances are its stairing me obviosly in the face, im asking here to see anyone with a freash approach and figure out the problem quickly.

    The javascript code is as below:

    Code:
    var target ;
    
    function a_edit(id){
    target = 'N_' + id;
    try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { // DontWork
    }
    xmlhttp.onreadystatechange = b_edit;
    xmlhttp.open("GET", '####&a=addform&id=' + id);
    xmlhttp.send(null);
    
    }
    function b_edit(){
    if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
    document.getElementById(target).innerHTML = xmlhttp.responseText;
    }
    }
    function c_edit(id){
    // Get Data
    var title = document.getElementById("N" + id + "_title").value;
    var cat = document.getElementById("N" + id + "_Cat").value;
    var update = document.getElementById("N" + id + "_time").checked;
    var news = document.getElementById("N" + id + "_NewsItem").value;
    
    xmlhttp.onreadystatechange = d_edit;
    xmlhttp.open("POST", '####&a=save&id=' + id + '', true);
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttp.send("title=" + title + "&cat=" + cat + "&update=" + update + "&news=" + news + "");
    
    }
    function d_edit(){
    if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
    
    var rsp = xmlhttp.responseText;
    // Spit Id and responce
    var rsp2 = rsp.split('||--||');
    var loc = 'N_' + rsp2[0];
    //Write responce to ID
    document.getElementById(loc).innerHTML = rsp2[1];
    
    
    } 	
    }
    var adin = 0;
    function n_Add(){
    
    if(adin== 1) {
    }
    else {
    // Load Ajax form for New news
    try {xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");}  catch (e) { // DontWork
    }
    xmlhttp.onreadystatechange = n_Add2;
    xmlhttp.open("GET", '####&a=New_addform');
    xmlhttp.send(null);
    }
    }
    var cur;
    function n_Add2(){
    if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
    cur = document.getElementById('addSpace').innerHTML
    document.getElementById('addSpace').innerHTML = xmlhttp.responseText + cur;
    adin = 1;
    }
    }
    function n_Add3(){
    //
    var title = document.getElementById("New_title").value;
    var cat = document.getElementById("New_Cat").value;
    var news = document.getElementById("New_NewsItem").value;
    
    xmlhttp.onreadystatechange = n_Add4;
    xmlhttp.open("POST", '####&a=addme', true);
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlhttp.send("title=" + title + "&cat=" + cat + "&news=" + news + "");
    
    }
    function n_Add4(){
    if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
    
    document.getElementById('addSpace').innerHTML = xmlhttp.responseText + cur;
    adin = 0;
    }
    }
    
    function delete_N(id) {
       if (confirm('Are you sure you want to delete this News Item?')) {
    // Ajax remove post
    xmlhttp.open("GET", '####&a=del&id=' + id);
    xmlhttp.send(null);
    // Make gone
    document.getElementById('N_' + id).innerHTML = "";
           }
           else {
    // Cancil remove prot
    alert ('Ok, no action has been taken');
       }
    }
    To be on the safe side i #### the urls until i get around to checking them security wize

    the code it works on

    Code:
    <div align="left">
    <div style="padding:6px"><a href="javascript:n_Add();">ADD NEWS BUTTON</a></div><br />
    
    <div id="addSpace"></div>
    
    <div id="N_6">
    
    <a href="javascript:a_edit(6);"><img src="http://thybag.co.uk/forum/style_images/bag/p_edit.gif" alt="Edit" style="border:0; float:right; position:relative;"></a><a href="javascript:delete_N(6);"><img src="http://thybag.co.uk/forum/style_images/bag/p_delete.gif" alt="Delete" style="border:0; float:right; position:relative;"></a>
    
    
    <img src="http://thybag.co.uk/mkportal/modules/gallery/album/t_a_348.jpg" alt="Mentor Avitar" width="106" height="150" style="padding:4px; float:left;  position:relative; z-index:4;">
    
    <h3><a href="#">Netscape Firefox Add</a></h3>
    
    <div style="padding:0px 0px 5px 0px;">
    
    <div align="left">
    Lets see about them there perms ey?<br>My <br>av<br>it <br>ar<br>Its a <br>little<br>big for this<br>new system maybe...<br><br>i think.. or do i <!--emo&:/--><img src='http://thybag.co.uk/forum/html/emoticons/hmm.gif' border='0' style='vertical-align:middle' alt='hmm.gif' /><!--endemo--> <!--emo&:)--><img src='http://thybag.co.uk/forum/html/emoticons/smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /><!--endemo--> YOu suck!
    
    </div>
    <div style="background-color:#CCCCCC; padding:2px;">
    <div style=" float:right; font-weight:bold;">
    0 <a href="#">Comments</a>
    </div>
    By <a href="forum/index.php?showuser=66"><strong>Mentor</strong></a> at 6:24 - 06/04/2006 
    </div>
    
    </div>
    
    </div>
    
    
    <div id="N_4">
    
    <a href="javascript:a_edit(4);"><img src="http://thybag.co.uk/forum/style_images/bag/p_edit.gif" alt="Edit" style="border:0; float:right; position:relative;"></a><a href="javascript:delete_N(4);"><img src="http://thybag.co.uk/forum/style_images/bag/p_delete.gif" alt="Delete" style="border:0; float:right; position:relative;"></a>
    
    
    <img src="http://img107.exs.cx/img107/1092/ufo6ld.gif" alt="Bag Avitar" width="75" height="53" style="padding:4px; float:left;  position:relative; z-index:4;">
    <h3><a href="#">Shizzle</a></h3>
    
    <div style="padding:0px 0px 5px 0px;">
    
    <div align="left">
    I think we have a working news system here! <br>I iz like well Chuffed with dat achivement Ey <!--emo&:D--><img src='http://thybag.co.uk/forum/html/emoticons/biggrin2.gif' border='0' style='vertical-align:middle' alt='biggrin2.gif' /><!--endemo--><br><br>Uz also smellzz
    
    </div>
    <div style="background-color:#CCCCCC; padding:2px;">
    <div style=" float:right; font-weight:bold;">
    0 <a href="#">Comments</a>
    </div>
    By <a href="forum/index.php?showuser=1"><strong>Bag</strong></a> at 12:07 - 05/04/2006 
    </div>
    
    </div>
    
    </div>
    
    
    <div id="N_1">
    
    <a href="javascript:a_edit(1);"><img src="http://thybag.co.uk/forum/style_images/bag/p_edit.gif" alt="Edit" style="border:0; float:right; position:relative;"></a><a href="javascript:delete_N(1);"><img src="http://thybag.co.uk/forum/style_images/bag/p_delete.gif" alt="Delete" style="border:0; float:right; position:relative;"></a>
    
    
    <img src="http://img107.exs.cx/img107/1092/ufo6ld.gif" alt="Bag Avitar" width="75" height="53" style="padding:4px; float:left;  position:relative; z-index:4;">
    <h3><a href="#">Thybag Ajax News Engine Online</a></h3>
    
    <div style="padding:0px 0px 5px 0px;">
    
    <div align="left">
    Yes, i think ive finaly managed to get this thing working. Thybags new system can now be edited without any refreshing, directly where it is via the edit button on the right of each artical. So far the forum parser is working perfectly and provideing the smilys and BB code as it is needed.<br><br>Wooot is my responce <!--emo&:D--><img src='http://thybag.co.uk/forum/html/emoticons/biggrin2.gif' border='0' style='vertical-align:middle' alt='biggrin2.gif' /><!--endemo--><br>PS. I am naked... really naked!<br>PSS. No wait, Thats not me. Just ryan... Why is ryan naked in my room?<br>PSSS. Feel the wind!<br>PSSSS. *Swipes Fan* MINE! *throws tantrum*<br>PSSSSS. I like Pie an i cannot lie!
    
    </div>
    <div style="background-color:#CCCCCC; padding:2px;">
    <div style=" float:right; font-weight:bold;">
    0 <a href="#">Comments</a>
    </div>
    By <a href="forum/index.php?showuser=1"><strong>Bag</strong></a> at 9:41 - 04/04/2006 
    </div>
    
    </div>
    
    </div>
    
    
    
    
    
    
    
    
    
    
    
    <div style="padding:12px">Pages: 1 2 3 4 5 6 .</div> </div></div>
      </div>
    	</div></div></div></div></div></div></div></div>
    
    </div><br>
    <br>
    Any obvios errors or idiotc stuff in there? or something wrong that would cause problems with IE copatablty?

    Thanks for any help

  2. #2
    Join Date
    Feb 2006
    Location
    Inside your PC
    Posts
    1,626
    Tokens
    0

    Latest Awards:

    Default

    what is ajax?

  3. #3
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    i form of coding like PHP and HTML
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  4. #4
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by :.:Numark:.:
    i form of coding like PHP and HTML
    Actually its just javascript.

  5. #5
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    still is a form of code as JS is a form of code...
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  6. #6
    Join Date
    Jun 2005
    Posts
    4,795
    Tokens
    0

    Latest Awards:

    Default

    You said AJAX is a form of coding witch is not totally true since its a name for a way of using javascript.

  7. #7
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    lets go back on topic, we are both right
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

  8. #8
    Join Date
    Feb 2006
    Location
    Inside your PC
    Posts
    1,626
    Tokens
    0

    Latest Awards:

    Default

    [off topic] Numark are u still a web designer for me? [/off topic]

  9. #9
    Join Date
    Feb 2006
    Location
    Coventry
    Posts
    2,096
    Tokens
    0

    Latest Awards:

    Default

    If i could iwould bag i dont understand half of that :@ Oh well ill learn

  10. #10
    Join Date
    May 2005
    Location
    /etc/passwd
    Posts
    19,110
    Tokens
    1,139

    Latest Awards:

    Default

    [offtpoic] Im not a web designer im a Site Techie , you just have to catch me on MSN [/offtopic]
    Quote Originally Posted by Chippiewill View Post
    e-rebel forum moderator
    :8

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •