/    Sign up×
Community /Pin to ProfileBookmark

simple problem of increasing text field

how can i add one text field after clicking each time a button.or how can i add specfic number of textfield after selecting a number with javascript.please reply me quickly

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@CrazyMerlinAug 26.2006 — use DOM!

var myTextField = document.createElement('input');

myTextField.type = 'text';

myTextField.size = 20

.

.

.

etc

document.body.appendChild(myTextField);
Copy linkTweet thisAlerts:
@muazzezAug 26.2006 — [color=brown]

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />

<title>Untitled Document</title>

<script type="text/javascript">



function createButton(){

var div = document.getElementById("div");



var newButton = document.createElement("INPUT");

newButton.setAttribute("type", "text");

newButton.setAttribute("name", "b" );

newButton.setAttribute("value", "shanto");



div.appendChild(newButton);

}



</script>

</head>



<body>

<div id="div">

</div>

<button onclick="createButton()">create button</button>

</body>

</html>[/color]


[color=navy]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />

<title>Untitled Document</title>

<script type="text/javascript">

var i=0;

function createButton(){

var div = document.getElementById("div");



var newButton = document.createElement("INPUT");

newButton.setAttribute("type", "text");

newButton.setAttribute("name", "b" );

newButton.setAttribute("value", i++);

newButton.setAttribute("size", "30");

newButton.setAttribute("id", "shanto");

// newButton.id="shanto" ;



div.appendChild(newButton);



}



</script>

</head>



<body>

<div id="div">

</div>

<button onclick="createButton()">create button</button>

</body>

</html>[/color]


[color=deeppink]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />

<title>Untitled Document</title>

<script type="text/javascript">



function createButton(){

var div = document.getElementById("div");



for(i=0; i<5; i++){

var newButton = document.createElement("INPUT");

newButton.setAttribute("type", "text");

newButton.setAttribute("name", "b" );

newButton.setAttribute("value", "shanto");

newButton.setAttribute("size", "30");

newButton.setAttribute("id", "div");



div.appendChild(newButton);



}

}



</script>

</head>



<body>

<div id="div">

</div>

<button onclick="createButton()">create button</button>

</body>

</html>[/color]


[color=green]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"



"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9" />

<title>Untitled Document</title>

<script type="text/javascript">



function createButton(){

var n =0;

var div = document.getElementById("div");



for(i=0; i<5; i++){

var newButton = document.createElement("INPUT");

newButton.setAttribute("type", "text");

newButton.setAttribute("name", "b" );

newButton.setAttribute("value", n++);

newButton.setAttribute("size", "30");

newButton.setAttribute("id", "div");



div.appendChild(newButton);



}

}



</script>

</head>



<body>

<div id="div">

</div>

<button onclick="createButton()">create button</button>

</body>

</html>[/color]
×

Success!

Help @shanto spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...