Solved

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

Posted on 2011-02-22
3
334 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now