By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,528 Members | 1,338 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,528 IT Pros & Developers. It's quick & easy.

Page to test a text manipulation function

P: n/a
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

Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Fabian hu kiteb:
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.


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


Jul 20 '05 #2

P: n/a
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

Jul 20 '05 #3

P: n/a
JRS: In article <bn*************@ID-174912.news.uni-berlin.de>, seen in
news:comp.lang.javascript, Fabian <la****@hotmail.com> posted at Wed, 29
Oct 2003 13:55:08 :-
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.

<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.
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.