User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 401,498 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,214 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 550 | Replies: 1
Reply
Join Date: Feb 2007
Location: London
Posts: 3
Reputation: Seb_london is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Seb_london Seb_london is offline Offline
Newbie Poster

Cutting text line

  #1  
Jan 24th, 2008
Hi,

Is there any way to end a line of text with three dot if this one is too long for the content box/site layout? Someting like wrap text but without going to the next line.

Thanks for your help
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Location: istanbul
Posts: 265
Reputation: serkansendur is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 23
serkansendur's Avatar
serkansendur serkansendur is offline Offline
Posting Whiz in Training

Re: Cutting text line

  #2  
Jan 25th, 2008
Originally Posted by Seb_london View Post
Hi,

Is there any way to end a line of text with three dot if this one is too long for the content box/site layout? Someting like wrap text but without going to the next line.

Thanks for your help


it is very easy to do with javascript as follows:

copy paste the code below into body section of your page for a demo, the process is very simple :

<script>
function SplitText(text,count)
{
if(text.length > count)
{
text = text.substring(0,(count-1));
text = text + "...";
}
return text;
}
</script>
<script>
function demo()
{
newText = SplitText(document.getElementById('Text1').value,10);
alert(newText);
}
</script>
<input id="Button1" type="button" value="button" onclick="demo()" />
<input id="Text1" type="text" />

Serkan Şendur
Last edited by serkansendur : Jan 25th, 2008 at 5:21 am.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 2:30 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC