473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

previous next buttons to load html files in div tag using ajax

Hi guys

I am developing a website using php and ajax. Here I need to to design previous and next buttons to load new html files with every click.

I am displaying these files within a div tag. So everytime the button is clicked only the html source of that div is refreshed and not other.

The names of html files are like page_1, page_2, ________.

I have already developed a function to load the specified html file inside the above said div.

My problem is to know the name of the html file currently displayed so that I can send it with function for previous and next button and retreive the new file name with some php function.

I have tried to give a hidden field with the html file with the name as the name of the current file, but my javascript function does not pick the value of that hidden field (may be because that is only a part of my div and is loaded dynamically through php function)
Apr 21 '07 #1
3 4502
All you need is a javascript variable that contains the name of the file opened like a mirror.
if you know the first file opened, you can know everyone. Example:

<script>
var n_file = 1; // global variable representing page_1.html file

function next() {
n_file+=1;
file = 'page_' + n_file + ".html";
// here goes the code to open the html in a div tag
}
</script>
<body>
<input type=button onClick="next();">
<--! other html tags-->
</body>

I think this will work.
My problem is exactly how can I open a html file in div tag. Can you tell me?
May 9 '07 #2
acoder
16,027 Expert Mod 8TB
Hi guys

I am developing a website using php and ajax. Here I need to to design previous and next buttons to load new html files with every click.

I am displaying these files within a div tag. So everytime the button is clicked only the html source of that div is refreshed and not other.

The names of html files are like page_1, page_2, ________.

I have already developed a function to load the specified html file inside the above said div.

My problem is to know the name of the html file currently displayed so that I can send it with function for previous and next button and retreive the new file name with some php function.

I have tried to give a hidden field with the html file with the name as the name of the current file, but my javascript function does not pick the value of that hidden field (may be because that is only a part of my div and is loaded dynamically through php function)
location.href should have the current url.
May 9 '07 #3
acoder
16,027 Expert Mod 8TB
My problem is exactly how can I open a html file in div tag. Can you tell me?
Use Ajax to get the response from the server. Then set the div to the response returned.
May 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Marcel | last post by:
Hello, I'm working on a search application for my website. The website contains a lot of pictures, and a search should return clickable thumbnails. No problems there. My problem started when I...
9
by: Karl Roes | last post by:
Hi All, I would like some advice on Next / Previous record buttons. I have a main form for the client, and a continuous subform listing client transactions. If I open one of these transactions...
4
by: msnews | last post by:
Hi All, My client has following request. I am not sure how to do it. Dynamically from database, we are getting set of images names. Now we want to display them with next and previous buttons....
1
by: Reb | last post by:
Hi all, I have not successfully found a Javascript sample for getting next and previous links from a file... I figured that someone must have solved this problem already! ... here is what I'm...
2
by: Jeff Allan | last post by:
Hello, I am trying to load an external HTML page into a DIV tag with .NET 05 and I can't figure it out. Any suggestions? My Scenario: - Gridview populated with list of available files - I...
1
by: patronise | last post by:
My problem is that I'm wrestling to make the LoadMovie and UnloadMovie functions work for me. Here is the layout of my flash file: I've got several seperate flash files and I can jump to any one of...
1
by: charlie imac | last post by:
I have a question on the capability of Ajax. My question is: Is it possible to dynamically load any of the javascript gallery programs such as: Adobe Spry Gallery SmoothGallery others I...
2
by: ravisuguna | last post by:
Hi, I have a php page which has some checkboxes ,textfields and values.If I select a checkbox ,a particular value will be displayed in a textfield.I have a "go"button in the same page.I want the...
3
by: =?Utf-8?B?a2FyaW0=?= | last post by:
Hello All, if I have this code: PictureBox1.ImageLocation = "c:\file.jpg" would I be able to add a next & prevous bottons to go to the next picture in this folder or the previous one? and if I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.