Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-04-2011, 03:52 PM   PM User | #16
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Sorry ... I don't want to assume something wrong ... but I think you still don't give us all the information we need

Most importantly: Where do you have (or where do you WANT to have) the call to topic.php? Where do the parameters come from?

As far as I understand: You want to click a link, start a request to topic.php with the two parameters id and quote.

Where do id and quote come from? What do you want to do with the output of topic.php? Do you want to write the output to the element #replyText or is this element part of topic.php and you only want to read the content of #replyText from topic.php?

You leave me confused.
devnull69 is offline   Reply With Quote
Old 07-04-2011, 06:38 PM   PM User | #17
slyfox
New Coder

 
Join Date: May 2009
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
slyfox is an unknown quantity at this point
Quote:
Originally Posted by devnull69 View Post
Sorry ... I don't want to assume something wrong ... but I think you still don't give us all the information we need

Most importantly: Where do you have (or where do you WANT to have) the call to topic.php? Where do the parameters come from?

As far as I understand: You want to click a link, start a request to topic.php with the two parameters id and quote.

Where do id and quote come from? What do you want to do with the output of topic.php? Do you want to write the output to the element #replyText or is this element part of topic.php and you only want to read the content of #replyText from topic.php?

You leave me confused.
Sorry for confusing you, let me try to sketch it a little better.

1) I have topic.php, which is a page that contains user comments.
2) At each user comment, there is a quote button so users can quote each others comments.
3) When that quote button is clicked, I want the ColorBox lightbox to open, with the a textarea that has the quoted text inside of it.

Everything is located on topic.php
slyfox is offline   Reply With Quote
Old 07-04-2011, 10:00 PM   PM User | #18
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
And where does $_GET come into play?

Do you just want to output $_GET["quote"] somewhere on the page into an invisible DIV and make this DIV visible as soon as you click on QUOTE? But this is exactly what you did in your very first post, given that $quote actually contains the quote.

Sorry I don't get it. Maybe someone else?
devnull69 is offline   Reply With Quote
Old 07-05-2011, 08:52 AM   PM User | #19
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
Quote:
Originally Posted by slyfox View Post
Well yes. But a textarea tag do not have a VALUE attr. So:

Code:
<textarea><?php echo $quote; ?></textarea>
No. As I have told you before, but you did not bother to read: TEXTAREA does have a value, and it does not have an innerHTML.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 07-05-2011, 09:11 AM   PM User | #20
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,245
Thanks: 10
Thanked 531 Times in 525 Posts
devnull69 will become famous soon enough
Wow ... I did not really know that <textarea> is such a weirdo

These tests have been performed using FF5

Test 1
Code:
<textarea id="mytext" value="My value text"></textarea>
This will show an empty(!) textarea

Test 2
Code:
<textarea id="mytext" value="My value text">My innerHTML text</textarea>

var myValue = document.getElementById('mytext').value;
var myInnerHTML = document.getElementById('mytext').innerHTML;
This will show a textarea with the text "My innerHTML text". Both variables will have this value, too.

Bottom line 1: A textarea will only show the text in the innerHTML area initially. The value attribute is being ignored

Test 3
Code:
document.getElementById('mytext').value = "My new value";
document.getElementById('mytext').innerHTML = "My new innerHTML";
var myNewValue = document.getElementById('mytext').value;
var myNewInnerHTML = document.getElementById('mytext').innerHTML;
This will change the content of the visible textarea to "My new value" (!). But the two variables in the end will have different content. But only the .value is relevant for the textarea.

Bottom line 2: To programmatically change the content of a textarea you'll have to set the .value property

Final result: To initially set the content of a textarea via HTML, you need to provide innerHTML. But to change or read the content afterwards, you'll have to use the .value property only. innerHTML will give you the current innerHTML at any given time but it will not always correspond to the visible textarea content!
devnull69 is offline   Reply With Quote
Old 07-05-2011, 09:28 AM   PM User | #21
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
Quote:
Originally Posted by devnull69 View Post
To initially set the content of a textarea via HTML, you need to provide innerHTML. But to change or read the content afterwards, you'll have to use the .value property only. innerHTML will give you the current innerHTML at any given time but it will not always correspond to the visible textarea content!
That is what I was talking about.
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:01 AM.


Advertisement
Log in to turn off these ads.