Ho w to create cookie using js in notepad?

Status
Not open for further replies.

ashwini jayaraman

Member level 2
Joined
Jan 17, 2013
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,601
Hi,
I tried creating cookies online..the same code is not working when I did in a notepad..What could be the issue?
please verify the code below!!!


Code HTML - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!DOCTYPE html>
<html>
<head>
<script>
function view(){
document.cookie="username=hello";
document.write(document.cookie);
 
}
</script></head>
 
<body">
 
<button type="button" onclick="view()">view</button>
 
</body></html>

 
Last edited by a moderator:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…