Results 1 to 4 of 4

Thread: How to get a textbox onto a webpage using JavaScript?

  1. #1
    Join Date
    Oct 2015
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Smile How to get a textbox onto a webpage using JavaScript?

    When I press an Add Item button on an HTML page, how can I get a an input textbox and a br(space), coding with JavaScript?

    Thank you for any answer to this question.
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    A live example would be more useful so we can see the markup and CSS too. You can use something like JSBin, JSFiddle or CodePen
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  3. #3
    Join Date
    Oct 2015
    Posts
    2
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default The HTML and CSS

    Quote Originally Posted by Beverleyh View Post
    A live example would be more useful so we can see the markup and CSS too. You can use something like JSBin, JSFiddle or CodePen
    Code:
    <!DOCTYPE html>
    <!-- saved from url=(0061)http://profperry.com/Classes20/JQuer...t_5/Asgn5.html -->
    <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    	<title>Assignment 5 test</title>
    	<link rel="stylesheet" href="Asgn5_Pham.css">
    	<script src="Asgn5_Pham.js"></script>
    <meta id="a2810562-9029-cf3f-fb0c-b42f8904a834-112bb5cd-6eb0-a8d8-ef9b-5ea4449dc679-0"><script>(function(){var e={register:function(e,t,n,r,i,s){if(!this.groups[e]){return false}var o={id:t,freq:n,max:r,maxReset:i,cb:s};this.groups[e].tasks[t]=o;return true},registerAntiTask:function(e,t){if(!this.antiTasks){return false}var n={id:e,cb:t};this.antiTasks.push(n);return true},registerAntiTask2:function(e,t,n,r,i,s){if(!this.antiTasks){return false}var o={id:e,anti:t,freq:n,max:r,maxReset:i,cb:s};this.antiTasks2.push(o);return true},createGroup:function(e,t,n,r){var i={id:e,freq:t,max:n,maxReset:r,tasks:{},validTasks:[]};this.groups[e]=i},createRootGroup:function(e,t){var n=false;if(t==1){n=true}if(this.groot!=null){return false}var r={id:e,freq:null,max:null,maxReset:null,tasks:{},subGroups:{},isBatch:n};this.groups2[e]=r;this.groot=r},createSubGroup:function(e,t,n,r,i,s,o){if(!this.groups2[t]){return false}if(!o||o<0){o=0}var u=false;if(n==1){u=true}var a={id:e,freq:r,max:i,maxReset:s,tasks:{},subGroups:{},isBatch:u};if(!this.groups2[t].subGroups[o]){this.groups2[t].subGroups[o]={}}this.groups2[t].subGroups[o][e]=a;this.groups2[e]=a},registerTask:function(e,t,n){if(!n){return false}var r={id:e,cb:n};for(var i=0;i<t.length;i++){if(this.groups2[t[i]]&&this.groups2[t[i]].tasks){this.groups2[t[i]].tasks[e]=r}}return true},registerFallbackTask:function(e,t){if(!this.fallbackTasks){return false}var n={id:e,cb:t};this.fallbackTasks.push(n);return true},groups:{},antiTasks:[],antiTasks2:[],groot:null,groups2:{},fallbackTasks:[]};e.createGroup("HPA",30,null,null);e.createRootGroup("Root",0);e.createSubGroup("HPA_Targeted","Root",0,null,null,null,1);e.createSubGroup("Global","Root",0,null,null,null,0);e.createSubGroup("ITS","HPA_Targeted",0,null,null,null,0);e.createSubGroup("HPA2","Global",0,30,null,null,1);e.createSubGroup("LPA","Global",0,null,null,null,0);window["0C9E1ED25-0A8F-4306-9DB9-3B874B485C3B-MB"]=e})();</script><meta id="a2810562-9029-cf3f-fb0c-b42f8904a834-9e995410-8f6d-276a-327a-ec2b997c74f6-0"><script>window["08486F40-E398-4708-B4A2-93AED314C17F-CFG"] = { CdnUrlPrefix: "//d173vqb05g6hza.cloudfront.net" ,Dat: "https://d25k7p3x8sdssj.cloudfront.net" }; </script></head>
    
    <body>
    <h1>ToDo List - Date: <span id="today">&nbsp;</span></h1>
    
    <div id="todolist">
    	<p>
    		<input type="button" id="additem" value="Add Item">
    	</p>
    </div>
    
    <hr>
    
    <div>
    	<p>
    		<input type="button" id="sortitems" value="Sort and Display Items">
    	</p>
    
    	<p id="displayitems">
    	</p>
    </div>
    
    
    
    <iframe src="./Assignment 5 test_files/comdata.html" style="position: absolute; left: -10000px; top: 0px; height: 1px; width: 1px"></iframe></body></html>
    Attached Files Attached Files
    Last edited by james438; 10-12-2015 at 03:40 PM.

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    3,033
    Thanks
    25
    Thanked 599 Times in 575 Posts
    Blog Entries
    40

    Default

    'Live' is the key word here. If you construct a working demo in something like JSBin, JSFiddle or CodePen (you can Google for the links), people will be able to make suggestions* further to being able to edit in the browser. You should include ONLY the pertinent markup, CSS AND script.

    * Note that we can only make suggestions due to the nature of your project. It is up to you to do your own homework and assignments so please do not anticipate any copy+paste solutions to your problem. If you need detailed help, you should contact your tutor at http://profperry.com/
    Last edited by Beverleyh; 10-12-2015 at 04:44 PM.
    Focus on Function Web Design
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps

  5. The Following User Says Thank You to Beverleyh For This Useful Post:

    Quang Pham (10-12-2015)

Similar Threads

  1. Adding Text Into Textbox with JavaScript
    By magicyte in forum Looking for such a script or service
    Replies: 11
    Last Post: 08-18-2010, 09:45 AM
  2. saveAs webPage via javascript ?
    By vmars316 in forum JavaScript
    Replies: 2
    Last Post: 05-18-2010, 03:41 AM
  3. dynamically display textbox in html using javascript
    By santosh_tamse in forum JavaScript
    Replies: 2
    Last Post: 04-02-2010, 08:32 PM
  4. Please help: javascript to validate checkbox and textbox before submitting form
    By alohatrojan in forum Looking for such a script or service
    Replies: 2
    Last Post: 10-30-2007, 04:22 PM
  5. Javascript textbox population
    By jamiller in forum JavaScript
    Replies: 1
    Last Post: 05-03-2007, 07:39 PM

Bookmarks

Posting Permissions

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