any ideas why this does not load? thanks for any assistance

<html>
<head>
<script type="text/javascript" src="coomang.js"></script>
<title>JS COOKIE MANAGER</title>
<link rel="stylesheet" type="text/css" href="coomang.css"> </link>
<script type="text/javascript" >
function loadcontent()
{
var x= "<div class="general">";
x += "	<div style="width: 150px; position: fixed;">CREATE 

COOKIE:</div>";
x += "	<div style="position: relative; left:170px">";
x += "	Name:<input id="cname" type="text"size="10"> Value: <input 

cvalue"type="text"size="10">";
x += "	<input type="button"value="SET"onclick="create()"/>";
x += "	<input type="button"value="CLEAR" onclick="clear1()" />";
x += "	</div>";
x += "</div>";
x += "<div class="general">";
x += "	<div style="width: 150px; position: fixed;">GET 

COOKIE:</div>";
x += "	<div style="position: relative; left:170px">";
x += "	Name:<input id="cname2" type="text"size="10">";
x += "	Value: <input id="cvalue2" type="text"size="30">";
x += "	<input type="button"value="GET" onclick="findcookie()">";
x += "	<input type="button"value="CLEAR"onclick="clear2()"  />";
x += "	</div>";
x += "</div>";
x += "<div class="general">";
x += "	<div style="width: 150px; position: fixed;">DELETE 

COOKIE:</div>";
x += "	<div style="position: relative; left:170px">";
x += "	Name:<input id="cname3" type="text"size="10">";
x += "	<input type="button"value="DEL" onclick="delete1()"/>";
x += "	<input type="button"value="CLEAR" onclick="clear3()" />";
x += "	</div>";
x += "</div>";
x += "<div class="general">";
x += "COOKIE RAW:<input id="raw" type="text" size="50">";
x += "<input type= "button" value="RAW" onClick="raw()"/>";
x += "<input type="button"value="CLEAR" onclick="clear4()"  />";
x += "</div> ";
   document.getElementById("contents").innerHTML=x;

}
</script>
</head>

<body onLoad= "loadcontent()">
<div id="contents">hiss!</div>
</body>
</html>

Recommended Answers

All 3 Replies

looking at your code above notice the color changes where the variables are all messed up by incorrect quotes

<html>
<head>
<script type="text/javascript" src="coomang.js"></script>
<title>JS COOKIE MANAGER</title>
<link rel="stylesheet" type="text/css" href="coomang.css"> </link>
<script type="text/javascript" >
function loadcontent()
{
var x= "<div class="general">";

first error shows in lline 9, cant include dquotes inside dquotes unless they are escaped use var x = "<div class='general'>"; all the way thru the file, fix the quotes
to prevent this recurring every time, get a decent editor with code highlighting, which will show you your errors, in the same way, by color changes
notepad+ notepad2 spring to mind
its a simple error that everyone makes the first few times

<html>
<head>
<script type="text/javascript" src="coomang.js"></script>
<title>JS COOKIE MANAGER</title>
<link rel="stylesheet" type="text/css" href="coomang.css"> </link>
<script type="text/javascript" >
function loadcontent()
{
var x = "<div class='general'>";

almostbob
thanks for your help. that worked :)
but what do u mean "unless they are escaped use"

in javascript & other scripting languages there is a character sequence used to tell the interpreter that the following control character is not to be treated as a control character,, the escape code
in javascript and php it is the backslash \
in ansi screen code from dos days, it is $e[ (actually it isnt bad, it was really hard to type THAT by accident)
to get a backslash in javascript you have to put in two backslashes, the first one to say 'ignore the following treat it as text'

var x = "<div class='general'>"; // works
var x = "<div class="general">"; // fails
var x = "<div class=\"general\">"; // works ::escaped dquotes are output as text not as delimiting the variable

other examples /n is a newline character, if you wish to include "divided by n" in some algebraic sense, it would have to be \/n

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.