473,491 Members | 2,159 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Howto Listen html link clicks and change them in STATIC HTML pages.....

there's an aspnet site. some pages are html and cannot be changed. (no
javascript nor links can be changed).
these pages have links. for example a.html calls b. html like:

<a href="b.html"page two link </a>

I need a listenet that can understand and say :

"hey somebody requested b.html." and will run some code, some db operations,
and according to result this istener will send b.html or instead of this it
will send another page...

any idea ?
Jun 27 '08 #1
2 897
Hi Aykut,
In the a.html you will need to capture the "OnClick" event of the anchor
tag....
Something like this <a id = "firstLink" href="b.html"
OnClike="ProcessClick()"page two link </a>

Then you will need to write the Javascript function:

<script language="javascript">
function ProcessClick()
{
var ancTag = document.getElementById("firstLink");
//check for NULL condition
if(ancTag != null)
{
//Make your DB calls here
//Change the href as following
ancTag.href = "../SomeResult.html";
}
}
</script>

Hope this helps.

Let me know.

regards,
Joy

"Aykut Canturk" wrote:
there's an aspnet site. some pages are html and cannot be changed. (no
javascript nor links can be changed).
these pages have links. for example a.html calls b. html like:

<a href="b.html"page two link </a>

I need a listenet that can understand and say :

"hey somebody requested b.html." and will run some code, some db operations,
and according to result this istener will send b.html or instead of this it
will send another page...

any idea ?
Jun 27 '08 #2
On Jun 4, 4:18 pm, Joy <J...@discussions.microsoft.comwrote:
Hi Aykut,
In the a.html you will need to capture the "OnClick" event of the anchor
tag....
Something like this <a id = "firstLink" href="b.html"
OnClike="ProcessClick()"page two link </a>

Then you will need to write the Javascript function:

<script language="javascript">
function ProcessClick()
{
var ancTag = document.getElementById("firstLink");
//check for NULL condition
if(ancTag != null)
{
//Make your DB calls here
//Change the href as following
ancTag.href = "../SomeResult.html";
}}

</script>

Hope this helps.

Let me know.

regards,
Joy

"Aykut Canturk" wrote:
there's an aspnet site. some pages are html and cannot be changed. (no
javascript nor links can be changed).
these pages have links. for example a.html calls b. html like:
<a href="b.html"page two link </a>
I need a listenet that can understand and say :
"hey somebody requested b.html." and will run some code, some db operations,
and according to result this istener will send b.html or instead of this it
will send another page...
any idea ?
HI...

What joy suggested works fine... need modification to the html
Content

but there is another way to do that...

i have used only javascript to do such kind of things

here it goes....
add a function on page's onload ...

<body onload="load_content()"like this..

and in my mark up i have,.....

<a id="mylink" href="Default.aspx">pagol naki</a>

now in load_content() method i have...

function load_content ()
{
var link = document.getElementById('mylink');
link.onclick = function()
{
window.alert('working');
//do your work...
//naviage it to some where else...
}
}

its works pretty fine and don't need to modify any thing on the
current html...

Best of luck

Munna
www.munna.shatkotha.com
www.munna.shatkotha.com/blog
www.shatkotha.com
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
2648
by: edykstra | last post by:
Hello, If you point your browser to this page, http://prdownloads.sourceforge.net/vnc-tight/tightvnc-1.2.9_x86_viewer.zip?use_mirror=umn the server sends you the HTML page, and very soon...
3
4117
by: John Doe | last post by:
et al, I've tried to find out on the 'net how to do this but can't seem to find it anywhere. How can I changed the cursors that show up in a windows application to be specific cursors that I...
4
2856
by: Josef Sachs | last post by:
Is Andrew Kuchling's regex-to-re HOWTO available anywhere? I've found the following (dead) links on various Web pages: http://py-howto.sourceforge.net/regex-to-re/regex-to-re.html...
1
1481
by: Kevin | last post by:
Hi All, Been reading post and thought this might be the right place to ask this. I have some static html pages. On hese pages there is an item that can and does change from day to day. What i...
9
48892
by: Randell D. | last post by:
Folks, I'm working on a contact name/address database whereby a slimed down list is shown in the main window. When a record is selected, the complete record is displayed in a new window via a...
7
3254
by: Xah Lee | last post by:
Summary: when encountering ex as a unit in css, FireFox (and iCab) did not take into account the font-family. Detail: http://xahlee.org/js/ff_pre_ex.html Xah xah@xahlee.org ∑...
17
2499
by: =?Utf-8?B?Y2F0aGFyaW51cyB2YW4gZGVyIHdlcmY=?= | last post by:
Hello, I have build a website with approximately 30 html-pages. When I search this website in Google, I see the index.html or home.html on this website, but also other html-pages on this...
15
5236
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
4
1897
by: Jeff | last post by:
I've been working on porting some perl CMS code to PHP. What I would do in perl is search through a template for instruction and replace those instructions with specific bits for that particular...
0
7115
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
7154
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
6858
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
5451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4881
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
4578
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
3086
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
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1392
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.