Onclick, innerHTML and Value trouble
What i want to do is output my image paths from the database so that i can list all the images and put them in links. These links could look something like this:
Then when it is clicked to get the innerHTML and put it into a textarea? Troube is it doesnt work for me has anyone got any ideas?
kb posted this at 01:22 — 26th April 2007.
He has: 1,380 posts
Joined: Feb 2002
Can you post some actual code?
As for what I think you're trying to do, ...what? JavaScript is a Client-Side language, meaning that it doesn't have access to a database, unless you start moving into AJAX, which is different.
If you want to access a database, use a language like PHP, Perl, etc.
What's the point of the onClick? I don't really follow that.
Post some code and I can be more helpful.
benf posted this at 14:23 — 26th April 2007.
They have: 426 posts
Joined: Feb 2005
Yes sorry my last post was a bit ambiguous. Basically, i am using timymce and havent got the upload script to add images, so i wanted to create links from all the image paths and embed an onclick like this:
<a href="#" id="{$image['id']}" onclick="addImage(this.id)">
<img src="{$image['path']}">
</a>
with the onclick insert the innerHTML of the link into the textarea so that it just inserts the whole image tag into tinymce.
However, i managed to get in to insert the path in to a textarea but with tinymce activated it doesnt work?!
Good Value Professional VPS Hosting
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.