D
dot
I'm trying to use the following hack to create an expanding/contracting
list of links:
<html>
<head>
<script language="Javascript" type="text/javascript">
function ChangeText(obj, originalText, newText){
if(obj.clicks == 1){
obj.innerHTML = originalText;
obj.clicks = 0;
}
else{
obj.innerHTML = newText;
obj.clicks = 1;
}}
</script>
</head>
<body>
<a href="javascript:void(0);" class="news"
onClick="ChangeText(news1,'','state2 ');">Summer 2004<div
id="news1"></div>
<a href="javascript:void(0);" class="news"
onClick="ChangeText(news1,'', '<a href="dir/file.html"> Link </a>
<p>');" Href example <div id=new2"></div>
</body>
</html>
The first call to ChangeText works, showing or hiding the text. The
second call with the quoted string in the href treats the double quote
after file.html as the matching quote that starts the string "ChangeText(...
I thought it was legal to embed the same kind of quote as long as you
alternate quote types (single/double). I guess not. I've tried escaping
the interior double quotes, but that doesn't seem to work either.
What am I missing?
Thanks
list of links:
<html>
<head>
<script language="Javascript" type="text/javascript">
function ChangeText(obj, originalText, newText){
if(obj.clicks == 1){
obj.innerHTML = originalText;
obj.clicks = 0;
}
else{
obj.innerHTML = newText;
obj.clicks = 1;
}}
</script>
</head>
<body>
<a href="javascript:void(0);" class="news"
onClick="ChangeText(news1,'','state2 ');">Summer 2004<div
id="news1"></div>
<a href="javascript:void(0);" class="news"
onClick="ChangeText(news1,'', '<a href="dir/file.html"> Link </a>
<p>');" Href example <div id=new2"></div>
</body>
</html>
The first call to ChangeText works, showing or hiding the text. The
second call with the quoted string in the href treats the double quote
after file.html as the matching quote that starts the string "ChangeText(...
I thought it was legal to embed the same kind of quote as long as you
alternate quote types (single/double). I guess not. I've tried escaping
the interior double quotes, but that doesn't seem to work either.
What am I missing?
Thanks