smiles Posted December 13, 2005 Share Posted December 13, 2005 Here is an example about prompt box of w3schoolshttp://www.w3schools.com/js/tryit.asp?filename=tryjs_promptso after I click on button and fill the gap ... what I write appear on the right page and the button is lost !!!I want it still appear there and what I write appears under it , for example : HelloI again click the button and write " Everybody " in the gap , click OK and what I see in the right is : (The button) Hello Everybody How can I do it ??? :)Thanks ! Link to comment Share on other sites More sharing options...
Guest Madu69 Posted December 13, 2005 Share Posted December 13, 2005 add a div tag after the <form> <div id="divdd" ></div>and change the code document.write as divdd.innerText and try to referesh and definetly. All the best:) Link to comment Share on other sites More sharing options...
smiles Posted December 13, 2005 Author Share Posted December 13, 2005 you mean that ? <html><head><script type="text/javascript">function disp_prompt(){var name=prompt("Please enter your name","")if (name!=null && name!=""){divdd.innerText ("Hello " + name + "! How are you today?")}}</script></head><body><form><div id="divdd" ></div><input type="button" onclick="disp_prompt()" value="Display a prompt box"></form></body></html>but I don't see it works maybe something you know but I don't know so I can't following your advise exactly anyway , thanks Link to comment Share on other sites More sharing options...
Jack McKalling Posted December 13, 2005 Share Posted December 13, 2005 Change: divdd.innerText ("Hello " + name + "! How are you today?")To:divdd.innerHTML = "Hello " + name + "! How are you today?" Link to comment Share on other sites More sharing options...
Chocolate570 Posted December 13, 2005 Share Posted December 13, 2005 <script type="text/javascript">var name=prompt("What's your name?");document.getElementById("divid").innerHTML="Hello "+name+", how are you today?"</script><div id="divid"></div> Final code. Link to comment Share on other sites More sharing options...
Jack McKalling Posted December 13, 2005 Share Posted December 13, 2005 No can do Choco :)Still not correct, as you define the ID after script, the script won't be able to get it Link to comment Share on other sites More sharing options...
smiles Posted December 14, 2005 Author Share Posted December 14, 2005 Sorry !!! but it isn't exactly what I want Link to comment Share on other sites More sharing options...
Jack McKalling Posted December 14, 2005 Share Posted December 14, 2005 What do you want to do with it then, what should it do?If the things you want to show should be accessable to other users too, I suggest go into a server-side language too :)But what else? Link to comment Share on other sites More sharing options...
smiles Posted December 15, 2005 Author Share Posted December 15, 2005 well ! Maybe I pay more attention to Javascript , client-side , so I had made my problem become more complex !!! Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now