on click set html code in form

Discussion in 'Javascript' started by Wouter, Nov 16, 2007.

  1. Wouter

    Wouter Guest

    Hi,

    I'm building a CMS (PHP). But i have a problem whit because i can't make the
    javascript that i need.

    I want that when i click on a link of a image, that then in a textearea the
    code for a image is showen.

    Is there some who can help whit this ?

    Greets Wouter
    Wouter, Nov 16, 2007
    #1
    1. Advertising

  2. Wouter

    Wouter Guest


    >> Is there some who can help whit this ?

    >
    > <img src="...." onclick="showSource(this.src)">
    >
    > function showSource(imageSRC){
    > document.myForm.myTextArea.value = '<img src="' + imageSRC + '">';
    > }
    >
    > <form name="myForm">
    > <textarea name="myTextArea"></textarea>
    > </form>
    >
    > That is a start. If you can write PHP then you can add the rest to the img
    > tag. Just use + instead of . for concatenation of strings.
    >


    Thanks for your answer! First sorry for my late reply. But i have some
    internet connection troubles here.

    Something like that is whet i need. But only i can now click on a image. I
    want that i can click on en link becuase want to make that i can place a
    image on the right, left or center.

    I have tryed to do something like your example. But is doen't work.

    <a href=http://www.google.nl/>google.nl</a>
    <script language="javascript">
    function showSource(imageSRC){
    document.myForm.myTextArea.value = '<img src="' + imageSRC + '">';
    }
    </script>
    <form name="myForm">
    <textarea name="myTextArea"></textarea>
    </form>

    Greets Wouter
    Wouter, Nov 17, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=

    Fire Code behind code AND Javascript code associated to a Button Click Event

    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    21,224
    =?Utf-8?B?Q2FybG8gTWFyY2hlc29uaQ==?=
    Feb 11, 2004
  2. Craig Kenisston

    HTML code warnings in asp.net html code view

    Craig Kenisston, Oct 7, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,089
    Martin Dechev
    Oct 7, 2004
  3. Alan Silver
    Replies:
    0
    Views:
    525
    Alan Silver
    Dec 21, 2005
  4. Amy
    Replies:
    5
    Views:
    1,666
  5. Daniish
    Replies:
    2
    Views:
    244
    Thomas 'PointedEars' Lahn
    Jun 13, 2008
Loading...

Share This Page