Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: help pleaseee

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb help pleaseee

    Could someone comment it plese... what does what!!!!



    var guestbook;
    window.addEvent('domready', domReady);
    //a custom event that fires when the DOM is ready to be manipulated
    function domReady() {
    var req = new Request.JSON({
    url: 'control.php?action=getPage',
    onSuccess: ajaxSuccess
    }).send()
    $('newComment').addEvent('submit', addComment);
    $('delete').addEvent('submit', deletee);
    $('edit').addEvent('submit', editt);

    }


    function ajaxSuccess(jArray){
    jArray.each(function(post){
    var postObject = new PostItem(post.id, post.name, post.comment);
    postObject.display().inject($('commentList'));
    });
    }
    function addComment(e){
    e.stop();
    var req = new Request({
    url:'control.php?action=insertPost',
    onSuccess:insert
    }).post(this);


    }
    function insert(idNo){
    new Element('span',{
    'text':'inserted item ' + idNo
    }).inject($('newComment'));
    }




    function editt(e){
    e.stop();
    var req = new Request({
    url:'control.php?action=editPost',
    onSuccess:edit2
    }).post(this);


    }
    function edit2(idNo){
    new Element('span',{
    'text':'edited item.'
    }).inject($('edit'));
    }

    function deletee(e){
    e.stop();
    var req = new Request({
    url:'control.php?action=removePost&id='+this.id.va lue,
    onSuccess:delete2
    }).send();
    }
    function delete2(idNo){
    new Element('span',{
    'text':'deleted item.'
    }).inject($('newComment'));
    }


    var PostItem = new Class({

    initialize: function(id, name, comment){
    this.id = id;
    this.name = name;
    this.comment = comment;
    },

    display: function(){
    var cont = new Element('div',{
    'class':'postItem',
    'id':'post'+this.id
    });

    var number = new Element('p',{
    'class':'postid',
    'text':this.id + ' is your ID'
    });

    var title = new Element('h3',{
    'class':'postTitle',
    'text':this.name + ' says...'
    });
    var comment = new Element('p',{
    'class':'postComment',
    'text':this.comment
    });
    number.inject(cont);
    title.inject(cont);
    comment.inject(cont);
    return cont;
    }


    });


  2. #2
    Junior Member
    Join Date
    May 2012
    Location
    Missouri
    Posts
    12
    My Mood
    Relaxed
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: help pleaseee

    Rarely can a programmer deciper a Java code without comments, sometimes not even the codes writer can find out what the code means.

  3. #3
    Member
    Join Date
    Apr 2012
    Location
    Superior, CO, USA
    Posts
    80
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default Re: help pleaseee

    This is JavaScript code talking to a PHP backend. This is a Java forum. If you're not sure which is which then read up a bit and ask in the appropriate places. And please don't PM people to answer these things.
    Need Java help? Check out the HotJoe Java Help forums!

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,335
    Thanks
    181
    Thanked 830 Times in 773 Posts
    Blog Entries
    5

    Default Re: help pleaseee

    Thread locked. Double posting is not allowed, and you should know the difference between java and javascript with fancy code like that.