JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 11th, 2013, 09:14 PM
Finelarme Finelarme is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2013
Posts: 1 Finelarme User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 m 45 sec
Reputation Power: 0
Question Need Help Debugging Script/Error in Script - Generate personal button with java (textual adventure building)

Hi all,

I've got two questions :

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

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;
</script>

-> But i'd like receive this button (with his script) instead of "answer" :

Code:
<div id="1">
<input type="button" onClick="return toggleMe('2')" value="to 2"></div>
<div id="2" style="display: none;">
2
<input type="button" onClick="return toggleMe('3')" value="to 3"></div>					  
<div id="3" style="display: none;">
3
<input type="button" onClick="return toggleMe('4')" value="to 4"></div>  
<div id="4" style="display: none;">
4 etc
</div>

//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;
  if(next.style.display=="none"){
    next.style.display="block"
    prev.style.display="none"
    window.scrollTo(0,0);
  } else {
    next.style.display="none"
  }
  return true;
  }
</script>

-> 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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Need Help Debugging Script/Error in Script - Generate personal button with java (textual adventure building)


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap