Solved

asp.net - divide the value of a varaible into 5 textareas...

Posted on 2011-02-22
3
337 Views
Last Modified: 2012-05-11
I have an asp.net page in vb.net....once the data is pulled from a sql connection...
it populates a varable...i need to divide the data in that varaible into 5 textareas...

the first 100 of the chars foes into ta1..the second 100 chars goes into ta2..etc...

the one thing is that the textareas run on the client not at the server...so I am using javascript...
0
Comment
Question by:GlobaLevel
  • 2
3 Comments
 
LVL 10

Author Comment

by:GlobaLevel
ID: 34956588
...am I on the right path here...?

<script language="javascript">
  function OnLoad()
  {
     document.getElementById('Textarea1').value.length <= 100
     document.getElementById('Textarea2').value.length >= 100 and
        document.getElementById('Textarea2').value.length <= 200
     document.getElementById('Textarea3').value.length >= 200 and
        document.getElementById('Textarea3').value.length <= 300
     //...and so on.....
}
</script>
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 34957299
Check this :


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="javascript">
	var fivehundred = "A12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678Z";
	fivehundred += "B12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678Y";
	fivehundred += "C12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678X";
	fivehundred += "D12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678W";
	fivehundred += "E12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678V";
	
	window.onload = function() {
		var five100 = fivehundred;
		var i = 0;
		for(var i=0;i<5;i++) {
			if(five100.length>=100) {
				document.getElementsByTagName("textarea")[i].value = five100.substr(i*100,100);
			}
			else {
				document.getElementsByTagName("textarea")[i].value = five100.substr(i*100);
				break;
			}
		}
	}
	
</script>
</head>
<body>
<textarea cols="100" rows="1"></textarea><br />
<textarea cols="100" rows="1"></textarea><br />
<textarea cols="100" rows="1"></textarea><br />
<textarea cols="100" rows="1"></textarea><br />
<textarea cols="100" rows="1"></textarea><br />
</body>
</html>

Open in new window

0
 
LVL 10

Author Comment

by:GlobaLevel
ID: 34972124
awesome!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
removing a class in javascript 4 47
Implement a function similar to grep in vanilla Javascript 3 18
Insert Button on a table 16 37
ASP.NET MVC - Views 3 17
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question