Remove the spaces before begin and after end of text

CK CK 3788 
Created at  
335 0 0
Followings are the sample code trimming by javascript.

<!--This is developed by Nepali guys
for Further information please email us at
ha.p@mailcity.com
shivascm@hotmail.com
-->

<html>
<head><title>Remove the spaces before begin and after end of text</title>
<script>
function ChkSpace(txtval)
{
var i,j;
j=0;
for(i=0;i<txtval.length;i++)
{
    j++
    if(txtval.substr(i,1)!=" ")
        break;
}
txtval=txtval.substr(j-1,txtval.length);
if(txtval==" ")
   txtval="";
return(txtval);
}

function Check()
{
var txtval=document.frm.txtarea.value;
txtval=ChkSpace(txtval);
document.frm.txtarea.value=txtval;
}
</script>
</head>

<body>
<form name=frm>
    <textarea name=txtarea cols=50 rows=10></textarea>
    <input type=button value="Check" onclick="Check()">
</form>
</body>
</html>

Tags Browser Cache HTML Javascript String Trim Trim Facebook X
Comments 0
Similar posts
  1. Code To Clear Browser History
    374
  2. Add This Page To Favorites
    397
  3. How To Close A Pop-up Window ?
    440
  4. Pop Up Window On Top
    514
  5. How to display message on browser status bar ?
    475
  6. New Window
    603
  7. Add A Scrolling Status Bar Text To Your Site
    407
  8. Button That Will Show The Page's Source
    385
  9. Button That Will Close The Browser Window
    349
  10. Icon Coupled Url
    425
  11. Book Mark This Site
    403
  12. Document Fader
    346
  13. Tooltip
    407
  14. Add Message On Mouse Traling
    2,546
  15. Number Of Vists
    507
  16. How to calculate page loading time ?
    358
  17. Move window
    546
  18. Color Table
    361
  19. Cursor Changer
    382
  20. Dual Scroller
    330
  21. Enlarge Image
    512
  22. Confirm The Link Clicked
    628
  23. Select And Deselect All Checkboxes By Javascript
    630
  24. Javascript Mouse Event Handler Example
    403
  25. Getting WebSearchers On Your Site
    372
  26. Hiding HTML on the browser
    457
  27. How to get date time in Javascript ?
    497
  28. Javascript based Alarm Clock
    659
  29. Javascript implemented Calendar
    420
  30. Basic Date Display
    508
  1. How to block a connection from the certain site ?
    350
  2. Is there URLEncode function in Javascript ?
    390
  3. Move window
    546
  4. How to calculate page loading time ?
    358
  5. Number Of Vists
    507
  6. Add Message On Mouse Traling
    2,546
  7. Tooltip
    407
  8. Document Fader
    346
  9. Book Mark This Site
    403
  10. Icon Coupled Url
    425
  11. Button That Will Close The Browser Window
    349
  12. Button That Will Show The Page's Source
    385
  13. Add A Scrolling Status Bar Text To Your Site
    407
  14. Add This Page To Favorites
    397
  15. Code To Clear Browser History
    374
  16. How To Close A Pop-up Window ?
    440
  17. Pop Up Window On Top
    514
  18. How to display message on browser status bar ?
    475
  19. New Window
    603
  20. Firefox Web Tweaking
    375
  21. Color Table
    361
  22. Cursor Changer
    382
  23. Dual Scroller
    330
  24. Enlarge Image
    512
  25. Confirm The Link Clicked
    628
  26. Send An Email Using A Bean
    1,014
  27. Select And Deselect All Checkboxes By Javascript
    630
  28. Javascript Mouse Event Handler Example
    403
  29. Getting WebSearchers On Your Site
    372
  30. Hiding HTML on the browser
    457
Recently updated
  1. Why 100% SEO Guarantees Better User Engagement and How to Achieve It in Your Service
    27
  2. Why SPF and DKIM Are Essential for Linux Email Servers?
    24
  3. How do I create animated background for Google Meet?
    19,730
  4. MaxMind GeoLite2 vs. DB-IP Lite vs. ip-api.com: Choosing the Right Free IP Geolocation Solution
    217
  5. Meet Valkey: Why Redis Changed Its License, Why Valkey is Better, and How to Use It as a Drop-in Replacement
    86
  6. How Rogue Web Scrapers Are Stealing My Content and Destroying My Server
    153
  7. Array of arguments passed to script in PHP
    85
  8. Invalid Auction Storms in Ad Tech
    93
  9. Building MRC-Compliant Instrumentation in Ad Tech: Implementation Steps and Key Challenges
    198
  10. The Two Clocks of Ad Server Architecture
    63
  11. Frequency Cap Architecture Overview
    509
  12. Collecting Proof-of-Play from 100,000 Screens
    141
  13. Vector Search in Relational Databases (RDBs): Trends & Usage Environments
    280
  14. What is RedisVL?
    105
  15. Designing a Skill Registry Architecture: Minimize Token Usage and Maximize AI Performance
    224
  16. TPU & GPU Cluster Management Tools
    234
  17. The Concept of Scaffolding in AI Agents
    222
  18. Beyond Static Pipelines: Architecting LLM Multi-Agent Systems for Autonomous Workflow Orchestration
    576
  19. AI-DLC vs. AI-SDLC: Model-Centric vs. System-Centric AI Development
    253
  20. Fine-Tuning Open-Weight LLMs: Training, Licensing, and Deploying Custom Models with Ollama
    328
  21. Inside the Next-Generation Streaming Architecture: Ultra-Low Latency, SGAI, and AI Codecs
    197
  22. Machine Learning: Training vs. Ranking
    213
  23. The Continuous Learning Machine: Designing a Loop That Actually Turns
    217
  24. The Next-Gen Low-Latency Standards: LL-HLS & MoQ
    189
  25. Designing a Data Curation System Around a Vector Database
    215
  26. Extracting Context from Live Video: The Architecture Got Simpler When We Stopped Building Features
    229
  27. The New Ad Stack Behind Live Sports Streaming: Inside SGAI, EABN, and the Standards Race to Fix Live Monetization
    649
  28. Designing MLOps Architectures to Handle Seasonal Data Drift in EV Fleet Models
    185
  29. From 15 to 40+ FPS: Accelerating PyTorch Object Detection on Automotive ECUs
    207
  30. Understanding Data Lineage
    252