473,466 Members | 1,413 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to use anchor tag in ajax ?

62 New Member
Hello ,
My questionis short but i think many people got the same problem with me..
Is it possible to use the anchor tag in ajax ? I want the ajax load the page with specified area by using anchor tag...if yes how ?
thank you so muc
Alexander
Jan 21 '08 #1
9 15162
gits
5,390 Recognized Expert Moderator Expert
hi ...

i think you should post an example because it is not very clear what you mean. you could use whatever node you want to start an ajax-call with any event you want that is supported by the node ... so with an anchor you could use the onclick-handler to call a function that starts the ajax-request ...

kind regards
Jan 21 '08 #2
paitoon
62 New Member
Hmm maybe i wrote wrong..
Ok..we talk about anormal page now..when u put the anchor tag to a page and u will get that page which specified area with forexample :
<a href ="example.php#hello">clickhere</a>

can we use this with ajax ?
Jan 21 '08 #3
gits
5,390 Recognized Expert Moderator Expert
as i said already ... simply use the XMLHttpRequest to call your php-script ...

[HTML]<a href="#" onclick="make_ajax_call();">click me</a>[/HTML]
where make_ajax_call is a javascript-function that invokes the call ... what do you think of would be a problem? may be i don't get the point?

kind regards
Jan 21 '08 #4
paitoon
62 New Member
My problem is I want to load that page and then i want window scroll down to the topic that i want to show it first..forexample in that page that i call consist of 3 topic

test.html

topic1................
bla
bla
bla bla bla

topic2
bla bla bla

topic3
bla
bla
bla bla

i want window scroll to the topic3 after the page is loaded..is it possible ?
that why i asked about name anchor tage which can use with the normal page ....but i want to know is it possible to use with AJAX ?
thank you so much
Alex
Jan 23 '08 #5
gits
5,390 Recognized Expert Moderator Expert
hmmm ... it is possible ... when the page is loaded you simply retrieve the top-coordinate of the anchor and use the scrollTo-method to scroll down ...

kind regards
Jan 23 '08 #6
paitoon
62 New Member
Ohh..sound great !! Do you have some example ? i really interested in what u will say..
Jan 23 '08 #7
paitoon
62 New Member
I forget to tell you...i know the function scroll to but how to make it work with this ?i means scroll to whereever i want proerly?
thanks again
Alex
Jan 23 '08 #8
gits
5,390 Recognized Expert Moderator Expert
so assuming your anchor has an id and you use mozilla/FF:

Expand|Select|Wrap|Line Numbers
  1. var anchor_node = document.getElementById('your_id');
  2.  
  3. window.scrollTo(0, anchor_node.offsetTop);
have a look here

kind regards
Jan 23 '08 #9
paitoon
62 New Member
thank you so much and i will try this...:-)
Alex
Jan 24 '08 #10

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

Similar topics

6
by: Daniele Baroncelli | last post by:
Hi guys, I would like to change the text in an anchor. es. from <a id="idanchor">oldtext</a> to
5
by: elsenraat_76 | last post by:
Hello! I was wondering if someone could help me out with a problem I'm having? I'm trying to input a javascript value into an anchor tag (from a function), but don't have an event to call the...
6
by: Richard Brown | last post by:
Ok, I celebrate and rejoice in the Anchor property. So wonderful compared to the horrible 'resize' code I had to write in VB6, there is just no end to the wonders of VB.NET..... uh, ok..... BUT......
3
by: gary | last post by:
Hi, I am trying to reference an anchor in a user control with a url. This worked in 1.1 but no longer works in 2.0. The ascx control is located in a "/include" folder If you have a...
10
by: elibol | last post by:
Hi, Is there an event that fires when the back or forward button on a browser is pressed? I need an event to fire when someone clicks the back or forward button after an anchor has been set. ...
5
by: Randy Webb | last post by:
The list below has the current section number, proposed anchor name, and then the current title of that section. Some make sense, some don't. There are a few that don't have proposed anchor names...
3
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a...
2
by: gvrajkumar | last post by:
Hi We are developing an Ajax based application. In this application the URL is fixed and as user navigates on the application we will change Anchor on the URL so that user can bookmark the url...
2
by: vunet | last post by:
I've been thinking about how AJAX sites implement page browsing when in fact the whole site is on one page. I know I may store page content in array and add new content to this array as user clicks...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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,...
1
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.