Quote extender

This is a discussion on "Quote extender" within the JavaScript Forum section. This forum, and the thread "Quote extender are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 29th, 2007, 10:24
Junior Member
Join Date: Jul 2007
Location: United States of England
Age: 27
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Quote extender

Hi all,

I'm not sure if its possible to do this in CSS, but I have a really lengthy quote to put onto a webpage and wondered if theres a way to put it so maybe the first few lines are displayed followed by a small (read more) text link which when clicked then immediately displays the rest of the quote instead of taking the user to a seperate page altogether.

Any ideas as to how to employ CSS to do this? Or if its a JavaScript thing can someone point me in the right direction.

Regards,

p.
Reply With Quote

  #2 (permalink)  
Old Aug 29th, 2007, 11:48
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

Is this quote coming from a DB and you don't know the length of it?

CSS has nothing to do with this. CSS is for presentational issues: colors, backgrounds, fonts, margins, padding, etc...
Reply With Quote
  #3 (permalink)  
Old Aug 29th, 2007, 11:53
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

You can do this with javascript:
Code: Select all
<script language="JavaScript">
<!--
	function expand(param)
	{
		param.style.display=(param.style.display=="none")?"":"none";
	}
//-->
</script>
If you only have one quote:
Code: Select all
<a href="javascript:expand(document.getElementById('div1'))">Title 1</a>
	  <div class="dottedBorders" id="div1" width="300px" style="display:none">
                    <p>some text</p>
</div
More than one quote, repeat the code and change the div1 to another div id name.
Reply With Quote
  #4 (permalink)  
Old Aug 29th, 2007, 12:20
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: Quote extender

Or with a server-side language like PHP.
Reply With Quote
  #5 (permalink)  
Old Aug 29th, 2007, 12:22
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

Yeah ... if his content is already drawn from a DB using PHP ... I would keep consistent and use PHP here too
Reply With Quote
  #6 (permalink)  
Old Aug 29th, 2007, 12:36
Junior Member
Join Date: Jul 2007
Location: United States of England
Age: 27
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

Thanks for the ideas guys. I was looking at a JavaScript widget they use at Flixster.com where the synopsis for a movie is given in two parts.

Code: Select all
<p id="plot" class="clearfix"><strong>Plot:</strong> some quick text and stuffs blah blah blah <span id="readMoreLink">...( <span class="jlink" onclick="synopsisWidget.showMore();">read more&nbsp;<img src="/static/images/icons/right-arrow.gif" alt="read more..."></span> )</span><span id="extraSynopsis" style="display: none;">more blah blah and extra information</span></p>
So I wondered exactly how it worked. I take it I should rule out any chance of a CSS fix? Then maybe this thread should be moved to a JavaScript sub-forum?

Regards.
Reply With Quote
  #7 (permalink)  
Old Aug 29th, 2007, 12:41
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

I'm just wondering what the purpose of this is?

Like I asked in my first reply, is your content (ie: this quote) stored in a DB?

If not ... then why use JS at all? If everything is hard coded in the document, then why not just manually add a "Read more" link?
Reply With Quote
  #8 (permalink)  
Old Aug 29th, 2007, 12:47
Junior Member
Join Date: Jul 2007
Location: United States of England
Age: 27
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

hi Karinne, to answers your question. The content is not stored in a DB but is hard coded in the document but I wanted a convenient way to not cause the user to get overloaded by seeing too much info at once on screen. That way if they are interested by what they can see they can click 'read more' and more info will appear isntead of taking them to a whole new page.

The suggestion that Lchad provided above seems to work well I just need to a solution now to make the (read me) link in mid-text disappear on click as the new text is revealed.

Any ideas?
Reply With Quote
  #9 (permalink)  
Old Aug 29th, 2007, 13:04
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

Ah ... gotcha! Now I understand.

I'll move this to the JS forum then
Reply With Quote
  #10 (permalink)  
Old Aug 29th, 2007, 13:16
Junior Member
Join Date: Jul 2007
Location: United States of England
Age: 27
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

Thanks Karinne, hopefully I'll get more help if it was in the JS forum too!
Reply With Quote
  #11 (permalink)  
Old Aug 29th, 2007, 13:16
karinne's Avatar
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Quote extender

I'm sure you will ... I know jack about JS
Reply With Quote
Reply

Tags
extender, quote

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
looking for job quote calculator bonnit PHP Forum 3 May 17th, 2008 13:29
Website Quote Deano Website Planning 0 Jan 11th, 2007 16:31
stock quote applet... wlandymore Other Programming Languages 0 Nov 26th, 2006 16:41
Freakish ASP quote handling jakyra Classic ASP 7 Sep 17th, 2003 17:11


All times are GMT. The time now is 23:58.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43