Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > need script to expose more text

Reply
Thread Tools

need script to expose more text

 
 
Randy Starkey
Guest
Posts: n/a
 
      07-14-2005
"Lasse Reichstein Nielsen" <> wrote in message
news:...

> Please don't top post.


OK. I'm not sure I know what this means, but I assume it means posting
before quoting? If so, OK.

> Lorem ipsum? Just the generic garble text. Read about it here:
> <URL:http://www.lipsum.com/>


OK - follow that.

Question - will this script simply put the button at the end of a line of
text, and then continue text when the plus is clicked? I need the default to
be collapsed with the plus showing, and the plus sign (or button) to go
simply at the end of a line of text. Also, do I need anything on the page at
the top after the body tag, or just copy in the script where I need it?
Thanks!

--Randy


 
Reply With Quote
 
 
 
 
ASM
Guest
Posts: n/a
 
      07-14-2005
Randy Starkey wrote:
> I'm lost on the french -


Which french ?

I don't know JS at all - are they comments?

Put this complete example in an html page and try it
That works pulling mouse over visible part of text.
A kind of roll-over

The hidden to visible part of text must be set between span tags
at the last of P element

I leave the example for your use

<p onmouseover="t=this.childNodes[1].style; t.visibility='visible';"
onmouseout="t.visibility='hidden';"
style="color:blue">
Here is a sentence whom unique goal is to reveal an other text. Pass
your mouse over me.
<span style="visibility:hidden;color:red"> I am the complementary part
of text.</span>


--
Stephane Moriaux et son [moins] vieux Mac
 
Reply With Quote
 
 
 
 
ASM
Guest
Posts: n/a
 
      07-14-2005
Randy Starkey wrote:
>
> Question - will this script simply put the button at the end of a line of
> text, and then continue text when the plus is clicked? I need the default to
> be collapsed with the plus showing, and the plus sign (or button) to go
> simply at the end of a line of text. Also, do I need anything on the page at
> the top after the body tag, or just copy in the script where I need it?
> Thanks!


copy/past all what proposed marked by '---' (from <script to </p>)
between tags <html> and </html>
in your notepad or other text editor
save as foo.htm

open this foo.htm in your browser and see and try the button

explain :
put the 1st script in header (between head tags)

where you want a button you past this code :

<script type="text/javascript">
writeMoreButton("loremMore");
toggleContent("loremMore", false);
</script>

then just after (or before if prefered) this script
you put your hidden text inside a span *idded* :

<span id="here_01">
My hidden text here
</span>

Do not forget to change the name in the script according to this of span
-> change "lorenMore" with "here_01"

that could give us :

<p>then just after this script you put your hidden text
inside a span or a P or a div *idded* : <script type="text/javascript">
writeMoreButton("here_01"); toggleContent("here_01", false);</script>
<br><span id="here_01"> My hidden text here</span>
</p>
<p>Other test : <script type="text/javascript">
writeMoreButton("here_02"); toggleContent("here_02", false);</script>
<span id="here_02"> second secret text</span>
</p>

--
Stephane Moriaux et son [moins] vieux Mac
 
Reply With Quote
 
Randy Starkey
Guest
Posts: n/a
 
      07-15-2005
"ASM" <> wrote in message
news:42d6dd1b$0$907$...
> Randy Starkey wrote:
>> I'm lost on the french -

>
> Which french ?
>
> I don't know JS at all - are they comments?
>
> Put this complete example in an html page and try it
> That works pulling mouse over visible part of text.
> A kind of roll-over


OK - Thanks!


>
> The hidden to visible part of text must be set between span tags
> at the last of P element
>
> I leave the example for your use
>
> <p onmouseover="t=this.childNodes[1].style; t.visibility='visible';"
> onmouseout="t.visibility='hidden';"
> style="color:blue">
> Here is a sentence whom unique goal is to reveal an other text. Pass your
> mouse over me.
> <span style="visibility:hidden;color:red"> I am the complementary part of
> text.</span>
>
>
> --
> Stephane Moriaux et son [moins] vieux Mac



 
Reply With Quote
 
Randy Starkey
Guest
Posts: n/a
 
      07-15-2005
"ASM" <> wrote in message
news:42d6e86a$0$1219$...

> copy/past all what proposed marked by '---' (from <script to </p>)
> between tags <html> and </html>
> in your notepad or other text editor
> save as foo.htm


OK. I think I got it. Thanks!


>
> open this foo.htm in your browser and see and try the button
>
> explain :
> put the 1st script in header (between head tags)
>
> where you want a button you past this code :
>
> <script type="text/javascript">
> writeMoreButton("loremMore");
> toggleContent("loremMore", false);
> </script>
>
> then just after (or before if prefered) this script
> you put your hidden text inside a span *idded* :
>
> <span id="here_01">
> My hidden text here
> </span>
>
> Do not forget to change the name in the script according to this of span
> -> change "lorenMore" with "here_01"
>
> that could give us :
>
> <p>then just after this script you put your hidden text
> inside a span or a P or a div *idded* : <script type="text/javascript">
> writeMoreButton("here_01"); toggleContent("here_01", false);</script>
> <br><span id="here_01"> My hidden text here</span>
> </p>
> <p>Other test : <script type="text/javascript">
> writeMoreButton("here_02"); toggleContent("here_02", false);</script>
> <span id="here_02"> second secret text</span>
> </p>
>
> --
> Stephane Moriaux et son [moins] vieux Mac



 
Reply With Quote
 
Randy Starkey
Guest
Posts: n/a
 
      07-15-2005
"Lasse Reichstein Nielsen" <> wrote in message
news:...
> "Randy Starkey" <> writes:


>> So this creates a small button?

>
> Yes, just a button with a "+" or "-" in it. If you want it styled,
> just use CSS and style the class "moreButton".


I'm getting double buttons for some reason?
See http://www.victorychurch.com/?page=52
slight adjustment needed?
Thanks! - Randy




 
Reply With Quote
 
Randy Starkey
Guest
Posts: n/a
 
      07-15-2005
"andrew" <> wrote in message
news:cKgBe.107730$HI.46216@edtnps84...
> Very rough, but you can modify it as you see fit...
>
> <script type="text/javascript">
> function expand(elem) {
> elem.innerHTML = '-'
> document.getElementById('more').style.display = 'block'
> }
> </script>
>
> Start of text <a href="#" onclick="expand(this)">+</a>
> <div id="more" style="display:none">More text</div>


simple and works to expand, but won't collapse?
--Randy



 
Reply With Quote
 
ASM
Guest
Posts: n/a
 
      07-15-2005
Randy Starkey wrote:

> I'm getting double buttons for some reason?
> See http://www.victorychurch.com/?page=52


you did write it twice
ist with javascript
2d with html

delete the 2nd

<SCRIPT type=text/javascript>
writeMoreButton("loremMore");
toggleContent("loremMore", false);
</SCRIPT>

here : line to delete
<INPUT class=moreButton onclick='toggleMore(this,"loremMore");'
type=button value=+>

--
Stephane Moriaux et son [moins] vieux Mac
 
Reply With Quote
 
ASM
Guest
Posts: n/a
 
      07-15-2005
Randy Starkey wrote:
> "andrew" <> wrote in message
> news:cKgBe.107730$HI.46216@edtnps84...
>
>
> simple and works to expand, but won't collapse?


these I did give do


<script type="text/javascript">
function showHide(elem) {
var v = elem.firstChild.nodeValue;
elem.firstChild.nodeValue = v=='[+]'? '[-]':'[+]';
elem.parentNode.lastChild.style.visibility=v=='[+]'?'visible':'hidden';
}
</script>

<p>Start of text
<a href="#" onclick="showHide(this); return false;">[+]</a><br>
<span style="visibility:hidden">More text</span>
</p>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
<a href="#" onclick="showHide(this); return false;">[+]</a>
<span style="visibility:hidden">Morbi a wisi. Mauris vulputate rutrum
arcu.</span>
</p>

--
Stephane Moriaux et son [moins] vieux Mac
 
Reply With Quote
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      07-15-2005
ASM <> writes:

> where you want a button you past this code :
>
> <script type="text/javascript">
> writeMoreButton("loremMore");
> toggleContent("loremMore", false);
> </script>
>
> then just after (or before if prefered) this script
> you put your hidden text inside a span *idded* :


Actually, you should put the call to "writeMoreButton" where you want
the button, but the call to "toggleContent" *after* the content that
must be hidden.


> that could give us :
>
> <p>then just after this script you put your hidden text
> inside a span or a P or a div *idded* : <script type="text/javascript">
> writeMoreButton("here_01"); toggleContent("here_01", false);</script>

just:
writeMoreButton("here_01");</script>

> <br><span id="here_01"> My hidden text here</span>

and
<script type="text/javascript">toggleContent("here_01",false);</script>
here.

/L
--
Lasse Reichstein Nielsen -
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
 
Reply With Quote
 
 
 
Reply

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
expose a event to IE clients via .Net remoting Max ASP .Net 0 05-07-2004 06:40 AM
Over expose or under expose with a canon 10d n Digital Photography 16 01-22-2004 02:25 AM
HtmlControls doesn't expose GridLayoudPanel? Paul Russell ASP .Net 0 11-03-2003 10:11 AM
expose for highlights or shadows? ralford Digital Photography 16 10-24-2003 03:33 AM
Expose Assembly As Web Service C ASP .Net 1 07-29-2003 11:56 PM



Advertisments
 



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 44 45 46 47 48 49 50 51 52 53 54 55 56 57