Online Shopping : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

71 of 115 people (62%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

how to i invoke 'save as' dialog box on click instead of displaying it on the current page

Apr 6th, 2008 19:47
ha mo, Colin Fraser, Shyam Reddy,


Yuor question is really poorly asked, I just do not understand what you
mean by saying : 
    instead of displaying it on the current page
Do you want to save a file that is different than the page you are
viewing?  Then if so, try this : 
function saveFile (fname)
{
	document.execCommand('SaveAs',null,fname)
}
You can use a button 
<input type="button" value="Save" onClick="saveFile('otherpage.txt');">
or text
<a href="javascript:null()" onClick="saveFile('otherpage.txt');">Save
File</a>
However, please recognise that what you are doing is to usurp the role
of the browser, while such things will work in many browsers, it will
not in others. So, why reinvent the wheel?
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com