Connecting Tech Pros Worldwide Forums | Help | Site Map

Page to test a text manipulation function

Fabian
Guest
 
Posts: n/a
#1: Jul 20 '05
I have created a javascript to manipulate a text strong given to it. It
works in all the situations I put it in. Now, I want to create a form
based interface. Essentially, the use types in the text in a form text
box, and it returns the manipulated text.

Ideally, I'd like it to return teh text in teh same page, without
reloading anything from the server. Problem is, I have no idea how to
capture anything entered into a form with javascript.

Help?


--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk


Fabian
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Page to test a text manipulation function


Fabian hu kiteb:
[color=blue]
> I have created a javascript to manipulate a text strong given to it.
> It works in all the situations I put it in. Now, I want to create a
> form based interface. Essentially, the use types in the text in a
> form text box, and it returns the manipulated text.
>
> Ideally, I'd like it to return teh text in teh same page, without
> reloading anything from the server. Problem is, I have no idea how to
> capture anything entered into a form with javascript.[/color]

ok, Ive found a script online which does mostly what i want. The problem
now, is weird.

---snip---

<SCRIPT LANGUAGE="JavaScript" SRC="numri.js">
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="numri-jp.js">
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
<!--
function response() {
var newtitle = document.form1.NumberInput.value;
var head1 = document.getElementById("head1");
en_uk.firstChild.nodeValue = numri(newtitle);
jp_ka.firstChild.nodeValue = numri-jp(newtitle);
}

function Xejn() { }
// -->
</SCRIPT>

<form name="form1">
<input type="text" name="NumberInput" size="25">
<input type="button" value="Change!" onClick="response();">
</form>

<HR>

<P>British English:<SPAN ID="en_uk"> </SPAN></P>
<P>Japanese:<SPAN ID="jp_ka"> </SPAN></P>
---snip---

The first two scripts loaded are rather convoluted text manipulation
scripts, for English and Japanese, respectively. The problem is that the
page utterly fails to find the numri-jp function. I can't see why not.
If I add the following line (and delete the numri-jp.js reference), it
won't work.

<SCRIPT LANGUAGE="JavaScript">
function numri-jp(i) {
return i;
}
</SCRIPT>

BUT if I then change all refernces to numri-jp() to numrijp(), it will
find the function. What's up with that?


--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk




Fabian
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Page to test a text manipulation function


Problem solved. I was using = instead of == in some if statements.

Thanks for your help, everyone who replied to this thread. You were
great. Couldn't have done it without you guys.


--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Dr John Stockton
Guest
 
Posts: n/a
#4: Jul 20 '05

re: Page to test a text manipulation function


JRS: In article <bnnnvo$13h5qj$1@ID-174912.news.uni-berlin.de>, seen in
news:comp.lang.javascript, Fabian <lajzar@hotmail.com> posted at Wed, 29
Oct 2003 13:55:08 :-[color=blue]
>I have created a javascript to manipulate a text strong given to it. It
>works in all the situations I put it in. Now, I want to create a form
>based interface. Essentially, the use types in the text in a form text
>box, and it returns the manipulated text.
>
>Ideally, I'd like it to return teh text in teh same page, without
>reloading anything from the server. Problem is, I have no idea how to
>capture anything entered into a form with javascript.[/color]


<URL:http://www.merlyn.demon.co.uk/js-quick.htm> does not do that; but
it uses techniques required to do that, and is reasonably short. View
Source. Make F.Result a textbox like F.Code.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> JS maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.
Closed Thread