/    Sign up×
Community /Pin to ProfileBookmark

How to add powerpoint slides to a webpage using Javascript

I am developing a website of online study with all the study material on powerpoint slides. Now i want to show these powerpoint slides in the webpages as in a window so that the other links can also be shown & there can be buttons from which there can be navigation of the slides. One method is using frames. But is there any other option so that i don’t have to use frames ?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@soccer362001May 12.2004 — The easiest way to put a power point presentation into a web page is to do

File

Save as Webpage.
Copy linkTweet thisAlerts:
@DeanC76Jul 03.2012 — Hi There,

I got so sick of trying all of the different options to web host a power point that were flaky or required flash so I rolled my own.

My solution uses a very simple javascript function to simply scroll / replace an image tag with GIFs that I saved from the Power Point presentation itself.

1) In the power point presentation click Save As and select GIF. Pick the quality you want to display the presentation at. Power Point will save one GIF image for each slide and name them Slide1.GIF, Slide2.GIF, etc.....

2) Create a HTML page and add a image tag to display the Power point GIF images.
[code=html]<center><img src="Slide1.GIF" id="mainImage" name="mainImage" width="100%" height="100%" alt=""></center>[/code]

3) Add some first slide, previous, next and last clickable objects with the onClick action as below:
[code=html]<a href="#" onclick="swapImage(0);"><img src="/images/first.png" border=0 alt="First"></a>
<a href="#" onclick="swapImage(currentIndex-1);"><img src="/images/left.png" border=0 alt="Back"></a>
<a href="#" onclick="swapImage(currentIndex+1);"><img src="/images/right.png" border=0 alt="Next"></a>
<a href="#" onclick="swapImage(maxIndex);"><img src="/images/last.png" border=0 alt="Last"></a>[/code]



4) Finally, add the below javascript function that when called grabs the next Slide.GIF image and displays it to the img tag.

[CODE]<script type="text/javascript">
//Initilize start value to 1 'For Slide1.GIF'
var currentIndex = 1;

//NOTE: Set this value to the number of slides you have in the presentation.
var maxIndex=12;

function swapImage(imageIndex){
//Check if we are at the last image already, return if we are.
if(imageIndex>maxIndex){
currentIndex=maxIndex;
return;
}

//Check if we are at the first image already, return if we are.
if(imageIndex<1){
currentIndex=1;
return;
}

currentIndex=imageIndex;
//Otherwise update mainImage
document.getElementById("mainImage").src='Slide' + currentIndex + '.GIF';
return;
}
</script>[/CODE]



Make sure the GIFs are reachaable from the HTMl page. They are by default expected to be in the same directory but you should b able to see the logic and how to set to a image directory if required

I'm honestly a javascript nube so possibly the code is not up to scratch but it worked for me. I have training material up for my company that uses this technique at http://www.vanguarddata.com.au so before you spend any time trying it out you are welcome to look at in in action.

I hope this helps someone else out there who is having as much headaches with this as I did.....
×

Success!

Help @sharanbrar 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...