/    Sign up×
Community /Pin to ProfileBookmark

Hi,

I found a script to do I wanted, but there is a problem;

the “ypslon” must starting always in ‘1’, but zpslon must starting after
ypson value + 2 (must have an interval of ‘1’

In this way the values, for example, must be, for example:

left
1 2 3 4

right
6 7 8 9

or

left
1 2 3 4 5

right
7 8 9 10 11 12

or yet

left
1 2 3 4 5 6

right
8 9 10

<html>
<head>
<title>Untitled</title>

<SCRIPT LANGUAGE=”JavaScript”>
function createLinks()
{
var count = document.getElementById(“ypslon”).value;
var sHTML = “”;
var ypslon=0;
var zpslon=0;

for(var x=0;x<count;x++)

{
sHTML += ‘<a href=”#” onclick=”concatColumn(‘ + (x+1) + ‘);return false”>Column ‘ + (x+1) + ‘</a><BR>’;

}

document.getElementById(“tdLinks”).innerHTML = sHTML;

}
</script>
<script>

function createLinks2(theForm){

var count2 = document.getElementById(“zpslon”).value;
var x=0;
var sHTML2 = “”;
ypslon = document.getElementById(“ypslon”).value;

var count2 = count2 * 2;

for(var x2=ypslon;x2<count2;x2++)

{
sHTML2 += ‘<a href=”#” onclick=”concatColumn(‘ + (x2+1) + ‘);return false”>Column ‘ + (x2+1) + ‘</a><BR>’;

}

document.getElementById(“tdLinks2”).innerHTML = sHTML2;

}

</SCRIPT>

<script type=”text/javascript”>

function concatColumn(colIndex){
var tableObj = document.getElementById(‘myTable’);
var string = ”;
var wordFrequency = new Array();
var wordArray = new Array();
colIndex–;
for(var no=0;no<tableObj.rows.length;no++){

var word = tableObj.rows[no].cells[colIndex].innerHTML;
if(!wordFrequency[word]){
wordFrequency[word]=1;
wordArray.push(word);

}else wordFrequency[word]++;

}

var string = ‘<table border=”1″><tr><th>Word</th><th>Frequency</th></tr>’;
for(var no=1;no<wordArray.length;no++){
string+='<tr><td>’+wordArray[no]+'</td><td>’+wordFrequency[wordArray[no]]+'</td></tr>’;

}
string+='</table>’;
document.getElementById(‘resultDiv’).innerHTML = string;

}

</script>

</head>

<body>

<form>

<textarea name=”t1″ rows=5 cols=50>

</textarea><br>

<INPUT NAME=”ypslon” TYPE=”text” value=”” size=2 textwidth=2><LABEL FOR=user>left</LABEL>
<INPUT NAME=”zpslon” TYPE=”text” value=”” size=2 textwidth=2><LABEL FOR=user>right</LABEL>

<INPUT TYPE=”BUTTON” onClick=”createLinks();” VALUE=”Left”>
<INPUT TYPE=”BUTTON” onClick=”createLinks2();” VALUE=”Right”>

<br><div id=”t2″></div>
<div id=”resultDiv”></div>

<TABLE>
<TR>
<TD ID=”tdLinks”></TD>
</TR>
<TR>
<TD ID=”tdLinks2″></TD>
</TR>

</TABLE>

</form>
</body>
</html>

Thank you in advance

Letchev

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsMay 25.2005 — Just because he says it so well:

You will need to explain better than that! :eek:

Can you tell use the situation first [i]then[/i] explain what [i]exactly[/i] it is you are trying to do.

Also, can you provide for us information on how you wish the user to trigger your function? And your pseudocode is very hard to understand, can you explain in your own words what it is supposed to do?[/QUOTE]
Copy linkTweet thisAlerts:
@Lebron_LetchevauthorMay 25.2005 — Ok.

I think I put the all problems at once! The function it is a start for building a script for input/output data from texts!

Firstly, taking in mind the whole script, please tell me as I put in

function createlinks2(), the value of ypslon minus 1, WHAT it is hard for me!

for(var x2=ypslon-1;x2<count2;x2++)


The value of ypslon is inputed by the user.

Thank you

Letchev
×

Success!

Help @Lebron_Letchev spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...