Jump to content

create new input text box in the same page when pressinh button


Revos

Recommended Posts

I am trying to do that when someone will press the button, it will create in the same page new input textbox, what I did is:

function blabla()
{
document.write("<tr><td> bla")
document.write(":</td><td><input name='Option")
document.write("' type='text' /></td></tr>") 
}

Everything is great, it does make a new textbox but it clears the page and then makes only new text box..I want it to create new text box in the same page, below the button, how?

thanks.

remove the single quotes:

style="display:none", not style="display:'none;'"

 

edit:

and another thing: for firefox (and every standards compilant browser for that matter) you should set style="display:table-cell" for tds, not block. You'll have to do some browser checking because IE doesn't recognise table-cell for display property.

actually, don't use display:block;

 

Not sure you set the script up, but here is what works

 

Let's say this is your html (notice the id in the tr tag)

<tr id="TR_ID" style="display:none;">
.....
</tr>

 

Your button will call the following Javascript function once clicked

<script>
function show_tr(){
document.getElementById('TR_ID').style.display = "";
}
</script>

You can add an if statment to toggle the display between "none" and "";

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.