Results 1 to 2 of 2
  1. #1
    Finelarme is offline Member
    Join Date
    Aug 2013
    Rep Power

    Default Generate Personal Button With Java (Textual Adventure Building)

    Hi all,

    I've got two questions :

    I use this script, send "word" for receive "answer" :

    Java Code:
    <form name="form1" method="post">
      <textarea name="fname1" value=""></textarea><br>
    <input type="submit" value="send"></form> 
    <script type="text/javascript">
    	function validateForm() {
    	var x = document.forms["form1"]["fname1"].value;
    	if (x === "word" ) {
    		document.forms["form1"].innerHTML +=("answer");   
    	} return false; }
    		document.forms["form1"].onsubmit = validateForm;
    -> But i'd like receive this button (with his script) instead of "answer" :

    Java Code:
    <div id="1">
    <input type="button" onClick="return toggleMe('2')" value="to 2"></div>
    <div id="2" style="display: none;">
    <input type="button" onClick="return toggleMe('3')" value="to 3"></div>					  
    <div id="3" style="display: none;">
    <input type="button" onClick="return toggleMe('4')" value="to 4"></div>  
    <div id="4" style="display: none;">
    4 etc
    //in <head>
    <script type="text/javascript">
    function toggleMe(a){
      var next=document.getElementById(a);
      var b=new String();
      b= a-1;
      var prev=document.getElementById(b);
      if(!next)return true;
      } else {"none"
      return true;
    -> Second question, is it also possible to define the button that will appear depending on what you will write in the text area ?

    Thanks for your help.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: Generate Personal Button With Java (Textual Adventure Building)

    This is a Java forum. JavaScript is not Java.

    Also, cross posted in the wrong section of the Ranch:
    Generate personal button with java (textual adventure building) (Beginning Java forum at JavaRanch)

    I'm closing this off topic thread and it will be removed later.


    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 1
    Last Post: 01-15-2013, 03:41 AM
  2. Help me in providing button to generate PDF of the jsp web content
    By in forum New To Java
    Replies: 1
    Last Post: 05-10-2012, 01:09 PM
  3. Newton Adventure
    By java software in forum Java Software
    Replies: 0
    Last Post: 12-29-2011, 06:46 PM
  4. Generate csv file on a button click
    By violeta in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-27-2009, 03:54 AM
  5. Replies: 0
    Last Post: 03-03-2009, 11:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts