Results 1 to 3 of 3

Thread: Javascript Loop Through Objects <Resovled>

  1. #1

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193

    Javascript Loop Through Objects <Resovled>

    hello people i have a problem

    out of a database im entering items into a rich textbox javascript control. On the page i am giving each textbox a name such as "txtbody" and with the article id number on the end

    ie so an example name would be txtbody1 if you were editing article 1

    the control requires me to update using the following javascript command

    updateRTE(txtn);

    (txtn) being the textbox name

    so basically how can i make this work

    var frm = document.frmedit;
    frm."conceptRTEvalue"+ctls[i].value = frm.'content'+ctls[i].value;

    the conceptRTEvalue is a hidden field

    ctls is an array populated by spliting an argument which contains the ID numbers

    content is the rich text box


    hope i have explained this ok, and thanks for your help

    Senorbadger
    Last edited by señorbadger; Aug 28th, 2004 at 01:31 AM.

  2. #2

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    bump bump bump

  3. #3

    Thread Starter
    Addicted Member señorbadger's Avatar
    Join Date
    Oct 2003
    Location
    Mud pools of wellingborough
    Posts
    193
    sorted it, i just used php to match the id numbers for the javascript then echoed it to the browser

    PHP Code:
    <?php 
    if (!empty($_POST[editmode]))
        {echo 
    "<script language='javascript' type='text/javascript'>\n";
    echo 
    "function updatertes()\n{\n";
    echo 
    "var frm = document.frmedit;\n";
        
    $articles mysql_query("select * from articles");
        for(
    $t=0;$t<mysql_num_rows($articles);$t++)
            {
            
    $chk "chk".mysql_result($articles,$t,"articleid");
            if (!empty(
    $_POST[$chk])) 
            {
            
        
    $ctrln "conceptRTEvalue".mysql_result($articles,$t,"articleid");
        
    $txtn 'content'.mysql_result($articles,$t,"articleid");
        echo 
    "updateRTE($txtn);\n";
        echo 
    "frm.$ctrln.value = frm.$txtn.value;\n";

            }
            }
    echo 
    "}\n</script>";
        }
    ?>
    thanks again senorbadger

Posting Permissions

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



Click Here to Expand Forum to Full Width