Still on custom screen building but help to convert Javascript to jQuery syntax

Hi,


If anyone has been following my journey to create a list screen with editable checkboxes in aprevious thread, you'll know I've hit a few issues. The basic page works, pretty much how I want it. I have to click the buttons twice to make the page submit, which is annoying but I can live with it.

I have hit a slight problem though. The page doesn't work as expected in Chrome and I suspect it is due to the javascript. I only know standard javascript. I don't know jQuery. There are 2 pieces of javascript embedded in the page when it loads and I need some help in getting it so that it works in Chrome if anyone can help.

Here they are:

var sJavaScript = "<script>";
sJavaScript += "function makeURL(){";
sJavaScript += "var oCB;";
sJavaScript += "document.getElementById('hdnAction').value = '';";
sJavaScript += "for (x = 0; x 'input').length; x++) {";
sJavaScript += "if (document.getElementsByTagName('input').item(x).type == 'checkbox') {";
sJavaScript += "oCB = document.getElementsByTagName('input').item(x);";
sJavaScript += "if(oCB.checked){";
sJavaScript += "document.getElementById('hdnAction').value+='&' + oCB.name + '=1'";
sJavaScript += "}}}";
//sJavaScript += "alert(document.getElementById('hdnAction').value);";
sJavaScript += "}";
sJavaScript += "</script>";


var sUpdateURL = "<script>function updateURL(){";
sUpdateURL += "if(parseInt(0+document.getElementById('cmli_comm_personid').value) > 0){";
sUpdateURL += "document.getElementById('hdnAction').value += '&pers_personid=' + document.getElementById('cmli_comm_personid').value;}";
sUpdateURL += "document.getElementById('btnAssign1').href = '" + sButtonURL + "' + document.getElementById('hdnAction').value + '&EMTarget=A';";
sUpdateURL += "document.getElementById('btnAssign2').href = '" + sButtonURL + "' + document.getElementById('hdnAction').value + '&EMTarget=A';";
sUpdateURL += "document.getElementById('btnDelete1').href = '" + sButtonURL + "' + document.getElementById('hdnAction').value + '&EMTarget=D';";
sUpdateURL += "document.getElementById('btnDelete2').href = '" + sButtonURL + "' + document.getElementById('hdnAction').value + '&EMTarget=D';";
sUpdateURL += "document.forms['EntryForm'].HIDDENSCROLLMODE.value=2;document.forms['EntryForm'].HIDDENSCROLLMODE_MyGrid.value=2;";
sUpdateURL += "document.EntryForm.submit();}";
sUpdateURL += "$(document).ready(function() {";
sUpdateURL += "$('#SearchSmallCmLi_Comm_PersonId').remove();});";
sUpdateURL += "</script>";


In the bottom script, there is a variable called sButtonURL and this is a string generated from this:

var sButtonURL = CRM.URL("EMList/EMList.asp");

It's just a standard CRM URL. The buttons on the page use this URL and I edit the HTML produced by CRM.Button() so that the button and anchors have ID tages which you can see referenced in the javascript as CRM doesn't put ID tags on many screen objects.

Any help would be greatly received.

Thanks.