Solved

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

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

729 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