Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Help Writing An Html Code (onclick Open Something)
h1dd3n
post Jul 31 2006, 03:06 PM
Post #1


Newbie [Level 1]
*

Group: Members
Posts: 15
Joined: 18-July 06
Member No.: 26,810



hi,

I am new in web development i want to make a page in which there are few buttons and on click of each button there is some hidden text field which becomes visible and user can enter the text he wish to in it. how can i ?
Go to the top of the page
 
+Quote Post
TypoMage
post Aug 1 2006, 03:07 AM
Post #2


Master of All Typos
*********

Group: Members
Posts: 621
Joined: 30-July 06
From: Earth, Usa, Maine, Waterford,
Member No.: 27,507
Spam Patrol



I have posted a few things that could help me about that stupid Cpanel mad.gif
I am still looking what icon I click on to make the website!! In my one day of being here. I am kinda disapointed. I wish that the shoutbox was working sad.gif Wahaa sad.gif
Go to the top of the page
 
+Quote Post
h1dd3n
post Aug 1 2006, 01:13 PM
Post #3


Newbie [Level 1]
*

Group: Members
Posts: 15
Joined: 18-July 06
Member No.: 26,810



same here for me ... sad.gif
Go to the top of the page
 
+Quote Post
rapidget
post Aug 1 2006, 01:16 PM
Post #4


Newbie [Level 2]
**

Group: Members
Posts: 34
Joined: 11-July 06
Member No.: 26,467



You guys should search for css tutorial.. it would help you... It's very easy... Look for it on google...
Go to the top of the page
 
+Quote Post
derickkoo
post Nov 3 2006, 08:02 AM
Post #5


Newbie [Level 2]
**

Group: Members
Posts: 29
Joined: 3-November 06
Member No.: 32,672



QUOTE(h1dd3n @ Jul 31 2006, 11:06 PM) *

hi,

I am new in web development i want to make a page in which there are few buttons and on click of each button there is some hidden text field which becomes visible and user can enter the text he wish to in it. how can i ?



ok, i have some time let me have a try
CODE

// test.html

<html>
<head>
    <title>just a demo</title>
    <style type="text/css">
    /*<![CDATA[*/
        #div1 {
            display:none;
        }

        #div2 {
            display:none;
        }
    /*]]>*/
    </style>
    <script type="text/javascript">
    //<![CDATA[
    function show(id) {
      if(id == 1) {
          document.getElementById('div1').style.display='block';
          document.getElementById('div2').style.display='none';
      } else {
          document.getElementById('div2').style.display='block';
          document.getElementById('div1').style.display='none';
      }
    }
    //]]>
    </script>
</head>
  <body>
       <div id="div1">
         <input type="text" name="txt1" value="here is text1 content" />
       </div>
  
        <div id="div2">
         <input type="text" name="txt2" value="here is text2 content" />
       </div>

     <input type="button" value="button1" onclic="show(1);" /> &nbsp;
     <input type="button" value="button2" onclic="show(2);" /> &nbsp;
   </body>
</html>
Go to the top of the page
 
+Quote Post
electriic ink
post Nov 3 2006, 08:23 AM
Post #6


Incest is a game the whole family can play.
Group Icon

Group: [MODERATOR]
Posts: 1,227
Joined: 11-February 05
From: Heaven
Member No.: 3,709



INTO HEAD:

CODE

   <script type="text/javascript">

     function show_buttons(show) {

               if (show == 'content_A') {

                   document.getElementById('content_B').style.visibility='hidden';
                   document.getElementById('content_A').style.visibility='visible';

                } else {

                   document.getElementById('content_A').style.visibility='hidden';
                   document.getElementById('content_B').style.visibility='visible';

                }

      }
   </script>


INTO BODY:

CODE
<input type="button" onclick="show_buttons('content_A');" value="Show A"> &nbsp; <input type="button" onclick="show_buttons('content_B');" value="Show B">

<input type="text" value="A" id="content_A" style="visibility: hidden">
<input type="text" value="B" id="content_B" style="visibility: hidden">


Both will give different results. Mine will reserve space on the page for text fields whereas derickkoo's won't. When a user displays his the content on the page will move down slightly - or so I believe. Try them both out.

NB:

CODE
<input type="button" value="button1" onclic="show(1);" /> &nbsp;
<input type="button" value="button2" onclic="show(2);" /> &nbsp;


Should read:

CODE
  <input type="button" value="button1" onclick="show(1);" /> &nbsp;
<input type="button" value="button2" onclick="show(2);" /> &nbsp;
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Java Script Drop Down Menu With Css(2)
  2. Onclick Image ->> Add Text To Input(text)field?(3)
  3. How To Insert Code With Javascript(7)
  4. Image Show With Thumbnail And Fade(2)
  5. Onclick & Ie(1)
  6. Html:multibox(1)
  7. Writing A Text File On Wen Host(1)
  8. Writing & Reading Files With Jsp(1)
  9. Picture Enlargement(2)
  10. Countdown Code Help(3)
  11. Fire Effect Code(0)
  12. Adding Rows & Columns In Html Table Using Javascript(1)
  13. How Do I Create An Array Of Objects?(3)
  14. My Code Does Not Connect To Database(1)
  15. Ajax: Achieve Ajax Program In 5 Lines Of Code!(1)
  1. Web Applications: J2ee Or Javascript/css/html(1)
  2. Ajax Code Need Help Debugging.(9)
  3. Kool Html(6)


 



- Lo-Fi Version Time is now: 8th October 2008 - 05:49 AM