www.webdeveloper.com
Results 1 to 2 of 2

Thread: Radio button not being checked in Chrome and Firefox... works in IE

  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Radio button not being checked in Chrome and Firefox... works in IE

    The following code works fine in IE 678and9 and checks the relevant radio button but not in chrome or Firefox. Can anyone spot anything obvious?

    document.write(' <input type="radio" name="useopt' + subid + '" value=1 ' + (eval('document.forms.mspage.text' + subid + '.useoptrb == "1" ? "checked" : "" ')) + ' onclick="useoptClick();" style="background-color:#0096ff;"> Default');

  2. #2
    Join Date
    Jul 2011
    Posts
    2
    Here is more of the code... lines i think that are not working in chrome or firefox are colored.

    <tr><td colspan="3" height="100%"><div style="width:100%; height:100%;overflow: auto;border:solid 1px #0096ff;background-color:white;">
    <input type="hidden" name="text277" id="id277" useoptrb="2" value="Test">
    <input type="hidden" name="text405" id="id405" useoptrb="2" value="Test2">
    <input type="hidden" name="text393" id="id393" useoptrb="1" value="">
    <input type="hidden" name="text269" id="id269" useoptrb="1" value="">
    <input type="hidden" name="text270" id="id270" useoptrb="1" value="">
    <input type="hidden" name="text406" id="id406" useoptrb="1" value="">
    <input type="hidden" name="text279" id="id279" useoptrb="1" value="">
    <input type="hidden" name="text281" id="id281" useoptrb="1" value="">
    <input type="hidden" name="text278" id="id278" useoptrb="1" value="">
    <input type="hidden" name="text271" id="id271" useoptrb="1" value="">
    <input type="hidden" name="text276" id="id276" useoptrb="1" value="">
    <input type="hidden" name="text275" id="id275" useoptrb="1" value="">
    <input type="hidden" name="text272" id="id272" useoptrb="1" value="">

    <script>
    function addel(ob) {
    arySubSection[arySubSection.length] = ob;
    }

    addel(["277", "Site Management", "YOUR COMPANY NAME is required ."]);
    addel(["405", "Selection of Contractors", "Domestic contractors are."]);
    addel(["393", "Site Rules", "The following rules will apply."]);
    addel(["269", "Training", "YOUR COMPANY NAME will ens."]);
    addel(["270", "Documentation", "Every Contractor shall provide ."]);
    addel(["406", "Communications", "The y."]);
    addel(["279", "Control of Access", "YOUR COMPANY NAME ."]);
    addel(["281", "Site Fencing", "Fencing will be ."]);
    addel(["278", "Hoarding", "All timber hoardings w."]);
    addel(["271", "Information and Signs", "A Health and Saf."]);
    addel(["276", "P.P.E.", "The site will be des."]);
    addel(["275", "Noise", "YOUR COMPANY NAME will continually ."]);
    addel(["272", "Dust and Mud", "If in periods of dry ."]);


    for (var ii=0; ii<arySubSection.length; ii++) {
    subid = arySubSection[ii][0];
    document.write('<table width="100%" cellspacing="0"><tr>');
    document.write('<td width="100%"><h3 class="mssubsectiontitle" name="title' + subid + '" id="title' + subid + '"><a href="javascript:edit(' + ii + ');" class="mssubsectiontitle">' + arySubSection[ii][1] + '</a></h3></td>');
    document.write('<td nowrap>');
    document.write(' <input type="radio" name="useopt' + subid + '" value=1 ' + (eval('document.forms.mspage.text' + subid + '.useoptrb == 1 ? checked="checked" : " " ')) + ' onclick="useoptClick();" style="background-color:#0096ff;"> Default');
    document.write(' <input type="radio" name="useopt' + subid + '" value=2 ' + (eval('document.forms.mspage.text' + subid + '.useoptrb == 2 ? checked="checked" : " " ')) + ' onclick="useoptClick();" style="background-color:#ccffbb;"> Own');
    document.write(' <input type="radio" name="useopt' + subid + '" value=0 ' + (eval('document.forms.mspage.text' + subid + '.useoptrb == 0 ? checked="checked" : " " ')) + ' onclick="useoptClick();" style="background-color:#D6D6D6;"> Exclude');

    document.write('</td></tr></table>');
    document.write('<div class="sectiontext" name="txt' + subid + '" id="txt' + subid + '" onclick="edit(' + ii + ');">' + strDefaultText + '</div>');
    document.write('<br>');
    }

    function writeTxt() {
    for (var ii=0; ii<arySubSection.length; ii++) {
    subid = arySubSection[ii][0];
    var df = document.forms.mspage;
    try {
    if (eval('document.forms.mspage.useopt' + subid + '[1].checked')) {
    txt = eval('df.text' + subid + '.value');
    eval('document.all.txt' + subid + (txt==''? '.innerHTML = strDefaultText' : '.innerText = txt'));
    } else if (eval('document.forms.mspage.useopt' + subid + '[2].checked')) {
    eval('document.all.txt' + subid + '.innerHTML = strDefaultText2');
    } else {
    eval('document.all.txt' + subid + '.innerText = arySubSection[ii][2]');
    }
    }
    catch (e) { alert(e.description); }
    }
    }
    writeTxt();

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles