Working with Input boxes

Page 1 of 1

3 Replies - 688 Views - Last Post: 07 March 2013 - 08:53 PM

#1 dcummin13  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 06-March 13

Working with Input boxes

Posted 07 March 2013 - 09:32 AM

Hi,

I am working a program for my personal website. This is a link to show how the program works: Website
Can someone help me modify it so that the text will appear in 3 input boxes instead of one. I want to click the text, it appears in Box 1, click again, Box 2 and then Box 3 (not at the same time).

var hasbeenset = false;
function setInput(id){
    if(hasbeenset){
        document.getElementById("myinput").value+=", " + id;
    }
    else{
        hasbeenset = true;
        document.getElementById("myinput").value=id;
    }
}
function showtext(id){
document.getElementById(id + "text").innerHTML=id;
}

<img width="50px" height="50px" src="https://pcbx.us/zachrip/yxo.jpeg" id="orange" onclick="showtext(this.id)"/>
<p onclick="setInput(this.id)" id="orangetext"></p>
<img width="50px" height="50px" src="https://pcbx.us/zachrip/yxp.jpeg" id="apple" onclick="showtext(this.id)"/>
<p onclick="setInput(this.id)" id="appletext"></p>
<img width="50px" height="50px" src="https://pcbx.us/zachrip/yxq.jpeg" id="banana" onclick="showtext(this.id)"/>
<p onclick="setInput(this.id)" id="bananatext"></p>
<input id="myinput" type="text" value="not set yet!"/>



Is This A Good Question/Topic? 0
  • +

Replies To: Working with Input boxes

#2 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 2890
  • View blog
  • Posts: 9,597
  • Joined: 12-December 12

Re: Working with Input boxes

Posted 07 March 2013 - 11:02 AM

Your original (duplicate) post started with the words "Summary of task", and the "website" you link to is just a jsfiddle, so I still suspect that this is homework.

But you haven't taken on board the advice I gave you previously - your code has barely changed. Good luck anyway!

This post has been edited by andrewsw: 07 March 2013 - 11:04 AM

Was This Post Helpful? 0
  • +
  • -

#3 dcummin13  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 06-March 13

Re: Working with Input boxes

Posted 07 March 2013 - 08:50 PM

View Postandrewsw, on 07 March 2013 - 11:02 AM, said:

Your original (duplicate) post started with the words "Summary of task", and the "website" you link to is just a jsfiddle, so I still suspect that this is homework.

But you haven't taken on board the advice I gave you previously - your code has barely changed. Good luck anyway!


Hi! Thank you for your response in the last post. I already graduated from college, so I no longer have homework ha ha. I'm not familiar with code. The sample I gave in jfiddle was sample code i found online but it was similar to what I'm trying to do. I haven't used the information you gave me last time because I wasn't sure where to go from there. Thank you for all your help though!

This post has been edited by Dormilich: 08 March 2013 - 05:05 AM

Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10188
  • View blog
  • Posts: 37,629
  • Joined: 27-December 08

Re: Working with Input boxes

Posted 07 March 2013 - 08:53 PM

Please avoid duplicate posting.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1