Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Prosty edytor
Gibcio2008
post
Post #1





Grupa: Zarejestrowani
Postów: 54
Pomógł: 0
Dołączył: 26.10.2008

Ostrzeżenie: (0%)
-----


Witam wszystkich !

Link się wstawia w textarea, ale gdy chcę wstawić drugi link skrypt kasuje całą zawartość textarea i nie wiem jak sobie z tym poradzić - proszę o pomoc.

Oto skrypt:

Kod
function Insert()
     {
         var prefix = document.getElementById('prefix').value;
         var target = document.getElementById('target').value;
         var url = document.getElementById('url').value;
         var name = document.getElementById('name').value;
        
         if(url.length > '0' && name.length > '0')
         {
             var link = '<a href='+prefix+''+url+' target='+target+'>'+''+name+'</a>';
            
             window.opener.form.text.value = link;
            
             window.close();
             window.opener.form.text.focus();
         }
     }
     </script>
Go to the top of the page
+Quote Post
23kulpamens
post
Post #2





Grupa: Zarejestrowani
Postów: 57
Pomógł: 1
Dołączył: 11.10.2007

Ostrzeżenie: (0%)
-----


Nie jestem pewien, nie wiem nawet jakie ID ma textarea, ale chyba nadpisujesz sobie wartość.
zamiast:
Kod
window.opener.form.text.value = link;

wpisz
Kod
window.opener.form.text.value =+ link;


i teraz powinno dodawać (IMG:http://forum.php.pl/style_emoticons/default/biggrin.gif)
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 21.12.2025 - 00:47