Page to test a text manipulation function

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fabian

    Page to test a text manipulation function

    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!
    AGAM69 menghadirkan inspirasi desain kreatif, solusi digital, pengembangan teknologi, serta inovasi modern untuk kebutuhan bisnis dan profesional.


  • Fabian

    #2
    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="JavaS cript" SRC="numri.js">
    </SCRIPT>
    <SCRIPT LANGUAGE="JavaS cript" SRC="numri-jp.js">
    </SCRIPT>

    <SCRIPT LANGUAGE="JavaS cript">
    <!--
    function response() {
    var newtitle = document.form1. NumberInput.val ue;
    var head1 = document.getEle mentById("head1 ");
    en_uk.firstChil d.nodeValue = numri(newtitle) ;
    jp_ka.firstChil d.nodeValue = numri-jp(newtitle);
    }

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

    <form name="form1">
    <input type="text" name="NumberInp ut" size="25">
    <input type="button" value="Change!" onClick="respon se();">
    </form>

    <HR>

    <P>British English:<SPAN ID="en_uk"> </SPAN></P>
    <P>Japanese:<SP AN 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="JavaS cript">
    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!
    AGAM69 menghadirkan inspirasi desain kreatif, solusi digital, pengembangan teknologi, serta inovasi modern untuk kebutuhan bisnis dan profesional.





    Comment

    • Fabian

      #3
      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!
      AGAM69 menghadirkan inspirasi desain kreatif, solusi digital, pengembangan teknologi, serta inovasi modern untuk kebutuhan bisnis dan profesional.


      Comment

      • Dr John Stockton

        #4
        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.demo n.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.demo n.co.uk/js-index.htm> JS maths, dates, sources.
        <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

        Comment

        Working...