Microsoft
Software
Hardware
Network
Question : Write a cookie
I'm using an ASP Ajax star rating script on my web pages. When the user clicks on a star it inserts that rating into my db and then hides star rating for that products uniqueID. But if the user hits refresh they can vote again on the same product. When I was going through the limited documentation that came with the script I couldn't figure out how they were writing the cookie.
Here is some of what I'm using:
<%
Dim strLinknum
strLinknum = rsLink("LINK_ID")
%>
<%
If Request.Cookies("RateSong"
)("Song" & strLinknum) = "True" Then
%>
<%else%>
D").Value)
%>">
D").Value)
%>" class="cgr">Vote on this video
NK_ID").Va
lue)%>').i
nnerHTML='
Poor - 1 star'" onmouseout="document.getEl
ementById(
'ra<%=(rsL
ink.Fields
.Item("LIN
K_ID").Val
ue)%>').in
nerHTML='V
ote this link'" title="Poor - 1 star" class="onestar" onClick="sndRating('<%=(rs
Link.Field
s.Item("LI
NK_ID").Va
lue)%>','1
');return false">1
NK_ID").Va
lue)%>').i
nnerHTML='
Fair - 2 stars'" onMouseOut="document.getEl
ementById(
'ra<%=(rsL
ink.Fields
.Item("LIN
K_ID").Val
ue)%>').in
nerHTML='V
ote this link'" title="Fair - 2 stars" class="twostars" onClick="sndRating('<%=(rs
Link.Field
s.Item("LI
NK_ID").Va
lue)%>','2
');return false">2
NK_ID").Va
lue)%>').i
nnerHTML='
Interestin
g - 3 stars'" onMouseOut="document.getEl
ementById(
'ra<%=(rsL
ink.Fields
.Item("LIN
K_ID").Val
ue)%>').in
nerHTML='V
ote this link'" title="Interesting - 3 stars" class="threestars" onClick="sndRating('<%=(rs
Link.Field
s.Item("LI
NK_ID").Va
lue)%>','3
');return false">3
NK_ID").Va
lue)%>').i
nnerHTML='
Good - 4 stars'" onMouseOut="document.getEl
ementById(
'ra<%=(rsL
ink.Fields
.Item("LIN
K_ID").Val
ue)%>').in
nerHTML='V
ote this link'" title="Good - 4 stars" class="fourstars" onClick="sndRating('<%=(rs
Link.Field
s.Item("LI
NK_ID").Va
lue)%>','4
');return false">4
NK_ID").Va
lue)%>').i
nnerHTML='
Excellent - 5 stars'" onMouseOut="document.getEl
ementById(
'ra<%=(rsL
ink.Fields
.Item("LIN
K_ID").Val
ue)%>').in
nerHTML='V
ote this link'" title="Excellent - 5 stars" class="fivestars" onClick="sndRating('<%=(rs
Link.Field
s.Item("LI
NK_ID").Va
lue)%>','5
');return false">5
<%End if%>
I did do a simple test to see I could actually keep the rating hidden by place a cookie on the page from the get go and it worked:
<%
Dim strLinknum
strLinknum = rsLink("LINK_ID")
%>
<% Response.Cookies("RateSong
")("Song" & strLinknum) = "True" %>
Answer : Write a cookie
There are NO cookies set in the code you showed
Random Solutions
How do you disable auto email address populator in Outlook 2003
Broadcom NetXtreme II Gigabit NIC(s) will not START
Ajax results - make selectable and populate input field
Fresh reinstall of Windows XP - not getting internet connection - what's wrong?
How do I use "on delete cascade" in my sql query?
other processes on xp remote pc
ODBC timeout
Local vs Roaming Profiles (with a bit of offline folder synchronisation chucked in)!
Groupwise 5.5 unable to print in XP on some machines?
SMTP Message queues (outbound) not being processed