Hi,

I am trying to create some dynamic content, which has got some
checkboxes as well. Neither it is selected nor the onclick works in
IE. It works fine Firefox. Any help would be highly appreciated.


Here is the code:
function buildReviews(response) {
        var reviewResults = $("reviewResults");
        var reviewsRow = new Element("div");
        reviewsRow.insert(new Element("hr"));
                response.result.each(function(review){
                    var row = new Element("div", {'id':'details'});
                    row.insert(new Element("div",{'id':'prodIdLbl'}).update
("<b>Product Id:</b> " + review.productId));
                    row.insert(new Element("div",{'id':'bookTitleLbl'}).update
("<b>Book Title:</b> " + review.bookTitle));
                    row.insert(new Element("div",{'id':'reviewerLbl'}).update
("<b>Reviewer:</b> " + review.reviewer));
                    row.insert(new Element("div",{'id':'emailAddrLbl'}).update
("<b>Email Address:</b> " + review.emailId));
                    row.insert(new Element("div",{'id':'reviewText'}).insert(new
Element("div").update("<b>Review Text:</b>")).insert(review.text));


                var dispFlag = new Element("div",{'id':'displayFlag'});
                dispFlag.insert(new Element("div",{'id':'flagLbl'}).update
("<b>Display on website <br> Product page:</b> "));
                    var flagCheckBox = new Element("div",{'id':'flagCheckBox'});
                    var infoId = 'rollOverInfo_'+review.id;
                    dispFlag.insert(new Element('img',{'src':'/img/Info.png',
'class':'bttnInfo', 'onMouseOut':'showRollover("'+infoId
+'",event);return false;','onMouseOver':'showRollover("'+infoId
+'",event);return false;'}));

                    dispFlag.insert(new Element("div",
{'id':'rollOverInfo_'+review.id, 'style':'display:none',
'class':'rollOverInfo'}).update("Check this check box to display on
Product page."));

                    var chkBox;
                    if (review.displayReview)
                         chkBox = new Element('input',{'type':'checkbox',
'id':review.id, 'onclick': 'javascript:setDisplayReviews(this.id,
this.checked)', 'checked':true});
                    else
                         chkBox = new Element('input',{'type':'checkbox',
'id':review.id, 'onclick': 'javascript:setDisplayReviews(this.id,
this.checked)'});

                    flagCheckBox.insert(chkBox);
                    dispFlag.insert(flagCheckBox);

                    var reviewInfo = new Element("div",
{'id':'setReviwInfo_'+review.id, 'style':'display:none',
'class':'reviwInfo'});
                    reviewInfo.insert(new Element('img',{'src':'/img/
infoReviewSetToDisplay.gif', 'class':'reviwInfoImg'}));
                    reviewInfo.insert("This Review is set to display on Product
page.");
                    var unsetReviewInfo = new Element("div",
{'id':'unSetReviwInfo_'+review.id, 'style':'display:none',
'class':'reviwInfo'});
                    unsetReviewInfo.insert(new Element('img',{'src':'/img/
infoReviewSetToDisplay.gif', 'class':'reviwInfoImg'}));
                    unsetReviewInfo.insert("This Review will not display on 
Product
page.");
                    dispFlag.insert(reviewInfo);
                    dispFlag.insert(unsetReviewInfo);

                    reviewsRow.insert(row);
                reviewsRow.insert(dispFlag);
                reviewsRow.insert(new Element("hr"));
                reviewResults.update(reviewsRow);
                });

}



function setDisplayReviews(reviewId, checked) {
        var url = "/setDisplayReviews.data?reviewId=" + reviewId +
"&checked=" + checked;
        new Ajax.Request(url, {
                method :'post',
                onSuccess: function(transport) {
                        try{
                                response = transport.responseText.evalJSON();
                if (checked)
                     infoDiv = $("setReviwInfo_"+reviewId);
                else
                     infoDiv = $("unSetReviwInfo_"+reviewId);
                infoDiv.style.display="inline";
                                new PeriodicalExecuter(function(pe) {
                                        infoDiv.style.display="none";
                                   pe.stop();
                                }, 3);                  }
                        catch(e){
                                if(console) console.log(e);
                        }
                }
        });

}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to