|
-
Aug 27th, 2004, 02:57 AM
#1
Thread Starter
Addicted Member
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.
-
Aug 27th, 2004, 03:14 PM
#2
Thread Starter
Addicted Member
-
Aug 28th, 2004, 01:30 AM
#3
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|