Sport Betting Bonuses - Winunited Bonuses - Loans - Debt Consolidation - Christmas Ecards

PDA

View Full Version : HyperCell (?) Link - Parsing Referrer + Cookie


danfirst
Mar 20th 2008, 7:24 pm
Hi, I'm really no expert. I don't even know if this is called hypercell.
But this seems like a simple thing, which I'm sure will be a piece of cake to the gurus out there.

I'm using this particular javascript technique whereby when a cell in a table has "onmouseover" the cell changes color, and when the cell has "onmouseout" it goes to a link.

A simple sample is as attached. Or basically the whole sample script is like this:
<html>


<head>
<meta http-equiv="Content-Language" content="en-us">
<script type="text/javascript">
function link1(){
window.location.href="http://www.google.com/";
}
</script>

<script type="text/javascript">
function link2(){
window.location.href="http://www.yahoo.com/";
}
</script>
</head>


<body>
<center>

<table border="1" width="200" cellspacing="0" cellpadding="0" height="100">
<tr>
<td onmouseover="this.style.background='#F1F7FA';this.style.cursor='pointer'" onmouseout="this.style.background='white';" onclick="link1()" width="50%" align="center">
<p align="center">Link to Google</td>
<td width="50%" align="center">
&nbsp;</td>
</tr>
<tr>
<td onmouseover="this.style.background='#F1F7FA';this.style.cursor='pointer'" onmouseout="this.style.background='white';" onclick="link2()" width="50%" align="center">
Link to Yahoo!</td>
<td width="50%" align="center">
&nbsp;</td>
</tr>
</table>

</center>
</body>


</html>

This script works great. Just that:

1. How do we make the links open in a new window?
2. When we click on the cells, how do we parse the REFERRER info as well as the cookie info? I find that using this script just treats the click as a new click to the link, but I'm sure that some info can be parsed.
.

So1
Mar 26th 2008, 8:18 am
1. use window.open("http://google.com") instead of window.location.href
2. what do u want to do with cookie? To get? no problems:
function readCookie(name)
{
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0)
{
offset = document.cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}

and then do with cookieValue what u want. How to get REFERRER info i dont know

danfirst
Mar 28th 2008, 12:01 am
Hey So1, thx alot for your help.
Just before I read your post, I actually tried window.open.
And the funny thing is, my initial method works, just that I had some settings wrong.
How silly of me, searching all over for information and waiting for help.
Guess I gotta be really careful next time.
Thanks anyway.

So1
Mar 28th 2008, 6:03 am
u're welcome ))

So1
Mar 28th 2008, 6:17 am
About REFERRER... I dont cnow what u use as server-side promgramming language (i use PHP).
U can generate JavaScript on server.

Just an exmple on PHP:
print "<script type='text/javascript'>var referer = " . $_SERVER['HTTP_REFERER'] . "</script>";
If user get this page via clicking link (<a href="our_page">). $_SERVER['HTTP_REFERER'] defined, otherwise u'll get notice message of PHP-interpretator. Use if(isset($_SERVER['HTTP_REFERER'])) condition.

danfirst
Mar 30th 2008, 9:29 am
Thx So1, nice work.
and ya, i do use PHP.