jaymc Posted November 3, 2006 Share Posted November 3, 2006 I want to have a link on a webpage that when clicked the link text is replaced by a form fieldSo, on the webpage would be[b]Click here to view the file upload box[/b]Then when they click that, the 'Click here to view the file upload box' text is replaced with this code[b]<input type='file' name='send'>[/b]Which will obviously display an input boxWhat code would do this effectively.Note, using document.write wont work alone as it will delete the rest of the page contents and jsut write out the form codeThanks Quote Link to comment Share on other sites More sharing options...
fenway Posted November 3, 2006 Share Posted November 3, 2006 You should be toggling hidden DIVs. Quote Link to comment Share on other sites More sharing options...
radalin Posted November 3, 2006 Share Posted November 3, 2006 while divs are much better ways. You could do something:[code]function toBox(field){ field.innerHTML = "<input type='file' name='send'>";}<span onClick="toBox(this)" id="field">Click here to view the file upload box</span>[/code]Something like this will work. But try hiding and showing divs. Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 3, 2006 Author Share Posted November 3, 2006 Cheers thats exactly what I needed !! Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 4, 2006 Author Share Posted November 4, 2006 Ahh, Ive ran into a problem field.innerHTML = "<input type='file' name='send'>";When the click [b]<span onClick="toBox(this)" id="field">Click here to view the file upload box</span>[/b] The input file box loads fine... great !!But, when clicking browse and selecting a file, the file location does not load into the boxI'm guessing because its not fully part of the page code, as it was called upon after the page/form loadAny ways around that?Hope Ive explained well enough Quote Link to comment Share on other sites More sharing options...
tomfmason Posted November 4, 2006 Share Posted November 4, 2006 Are you wanting to view the contents of the file in the text box or ?? Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 4, 2006 Author Share Posted November 4, 2006 No... basically when you click browse on any input file box, you select a file from your local HD and the DIR path will be loaded in the text area box..Well, its not loading in their, obviously because of some kind of issue of how the input box is being loaded Quote Link to comment Share on other sites More sharing options...
jaymc Posted November 4, 2006 Author Share Posted November 4, 2006 Edit : its ok ive sorted it nowthanks for help :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.