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
Message queue que.dat keeps regenerating spam
Insert Hyperlink in email in Outlook 2007 slow to initially display folders on networked My Documents
Vista has started to not allow me to run .exe files. How come?
Top Percent with varable
DHTML's Window.SetInterval HELP
Flash Flipping Book: How do I prevent printing functions from also exiting fullscreen mode?
Tracking Changes in Excel spreadsheet with a Pivot Table
In Excel, How can I calculate the difference in days ( and Workdays) between two dates?
Reports/Forms Server
preload a html page while flash movie is playing