Categories > TinyButStrong general >

Proper syntax for creating a string put as a value for ID= in a <div>

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: BobC
Date: 2006-01-08
Time: 06:20

Proper syntax for creating a string put as a value for ID= in a <div>

Hello,

I'm trying to add the equivalent of:    

ID="Status"+[blk1.id]   onClick="doqueryalertId('Status'+[blk1.id])"    

Basically trying to set the ID= and the variable passed to a javascript function to be a set text + numerical value such as Status134 Status135 etc.. where the numerical value was taken from a database. I am having a problem getting the proper syntax down for the html portion of it...

my snippet of code that I want to add this to is here:
<td><div align="right">[blk1.Status;block=tr;ondata=change_status_blk1;.]</div></td>

For anyone that wants to do this.. this function basically identifies the cell and lets you change the value of the cell without refreshing the page.  I plan to do a database update and then change the value in the table after the database update is verified to have been successful.  I'll use AJAX to kick off the update and verify the change was successful in the database.

My unfinished javascript code is here.. just basic while I get the syntax down.. I don't need help with this part. If anyone wants the finished code , I'll post it when I'm done.
<script>
function domysqlupdate(what)
{
var location = document.getElementById(what);
location.innerHTML=what;
}
</script>
By: BobC
Date: 2006-01-08
Time: 17:07

Re: Proper syntax for creating a string put as a value for ID= in a <div>

Ok.. well now that I'm not make this harder than it needs to be... I found the answer.. just seemed too simple.. but hey I guess that's why I'm using TBS to make thing easy !!!

ID="Status[blk1.id]" onClick="domysqlupdate('Status[blk1.id]')"

And this automatically concantenates it...