Solved

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

Posted on 2011-02-22
3
338 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

726 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