Need Help!
i think i'm in the right forum.... this is the only one that talks about html in the description.
I have a web-page i need to make a link to where it will save the "registration form" document when a visitor click on the link I'd like a dialog box to pop up with possibility for the visitor to save the document on his/her mard drive.
How do I accomplished this HTM/HTML coding?
thanks in advacned
[435 byte] By [
New_Brink] at [2007-11-20 7:16:31]

# 1 Re: Need Help!
You can only invoke this in Internet Explorer.
function savepage(){
if(document.execCommand){
document.execCommand("SaveAs");
}
# 2 Re: Need Help!
now i dont know anything about web programming (trying to helpa friend out). but how the code know what document to "save"
# 3 Re: Need Help!
You cannot save a web page directly, you can only invoke the "Save As..." dialog in IE. Now, if you want to use a server-side language, you can output the source and then download the file, but that would include you learning a language.
As to the "Save As..." I have already provided you with the code.
<script type="text/javascript">
function savepage(){
if(document.execCommand){
document.execCommand("SaveAs");
}
}
</script>
<a href="javascript:savepage()">Save</a>
# 4 Re: Need Help!
i dont want to save the web page i was think that it could save the document..... actually what would be easier would be to have a link "Registration Form" and have it open up a new window with the document in it and they can print or save it then.
thanks for your help again and in advacned
# 5 Re: Need Help!
So you only want to save the registration form part of the web page? Then you will have to refer back to my post.
Now, if you want to use a server-side language, you can output the source and then download the file, but that would include you learning a language.
# 6 Re: Need Help!
sorry for being such a moron but can i get the code for where they can click on a link that says "Registration Form" and it will open up the form in another window.
# 7 Re: Need Help!
sorry for being such a moron
You aren't. There are many beginner who come here for help.
but can i get the code for where they can click on a link that says "Registration Form" and it will open up the form in another window.
Okay. This clarifies what you want to do. Try the following code.
<script type="text/javascript">
function openform(){
var winParam = "top=0,left=0,width=480,height=320";
var url = "registration.html";
var winReg = window.open(url, "winName", winParam);
}
</script>
<input type="button" value="Registration Form" onclick="openform()">
# 8 Re: Need Help!
Wow, lets slow down a bit. Is what you want a form with a button which when clicked launches a download?
If so then a good way to do this is to use a server-sided language as pointed out. On the web there are two basic sides (for simplicities sake) - the client and the server. When you surf the web you are the client, the place where you get your webpages from is called the server. When you submit your form it goes over to the server side and a server-sided programming language picks it up and does something with it.
So if you want to launch a download and store the registration document, the easiest way which will work on all browsers is to learn a a server-side language. The most widely used is PHP. There is also ASP, Perl and Java Server Pages but I would personally recommend PHP.
But this will take a long time to learn and isn't something you can just pick up in an afternoon, but it is the best way to do what you've asked for.