/    Sign up×
Community /Pin to ProfileBookmark

Saving only a portion of webpage into a file

hello,
im working on a web application that generates dynamic data. My question is: i want users to be able to save the generated data, but not the whole web page, just a table in the web page that holds this data. I searched and found out that showing a “save as” dialog box is possible with javascript, with a method like: [COLOR=Indigo] onclick=”javascript: document.execCommand(‘SaveAs’,’1′,null);[/COLOR]. However, i coulnd’t find out how to change the document object (or is it possible?) or a trick to print just the table of dynamic data. I tried to cover the table with <div id=”myData”></div> and use [COLOR=Indigo] onclick=”javascript: myData.execCommand(‘SaveAs’,’1′,null);[/COLOR] but as you might guess, it didn’t work and gave this error message: “object doent support this property or method”. Indeed i dont have any idea what div tag can and can’t do, so it was just a meaningless try.
Anyway, do you have any suggestions?

thanks in advance,
ibrahim sayg&#305;l&#305;

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@airyhadesauthorApr 29.2006 — by the way, i want to add that i can't use iframes just because of program design issues.
Copy linkTweet thisAlerts:
@userloginApr 29.2006 — How about trying to put the 'Table' into a 'Table' as in an Excel table?

DHTML exists that cna help you do this.
Copy linkTweet thisAlerts:
@felgallApr 29.2006 — Is this for an intranet? The JScript execCommand() function should be disabled by security settings on the internet and only works in IE anyway. Javascript has no file access commands at all apart from cookies.
Copy linkTweet thisAlerts:
@airyhadesauthorApr 30.2006 — yes you are right. it doenst seem a good solution. but i didnt understand about "excel solution" told 2 above..
Copy linkTweet thisAlerts:
@felgallApr 30.2006 — The only way to set up a page of dynamic content for your visitors to be able to save is to use a server side script to generate a new page of file on the server that they can then save or download. If you use .NET on the server then you could convert the info they enter into an Excel spreadsheet and offer that for download.
×

Success!

Help @airyhades spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...