rich1234
05-18-2008, 10:14 PM
Switch Content Script II (icon based)
http://www.dynamicdrive.com/dynamicindex17/switchcontent2.htm
Hi, I have set this script up but i cannot get the ajaxt bit to work.
I have
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<link rel="stylesheet" type="text/css" href="css/new.css">
<script type="text/javascript" src="js/switchcontent.js" ></script>
<script type="text/javascript" src="js/switchicon.js"></script>
</head>
<h2>Demo 1:</h2>
<p><a href="javascript:faq.sweepToggle('contract')">Contract All</a> | <a href="javascript:faq.sweepToggle('expand')">Expand All</a></p>
<div class="eg-bar"><span id="faq1-title" class="iconspan"><img src="minus.gif" /></span>What is JavaScript?</div>
<div id="faq1" class="icongroup1">
</div>
<br />
<div class="eg-bar"><span id="faq2-title" class="iconspan"><img src="minus.gif" /></span>Difference between Java & JavaScript?</div>
<div id="faq2" class="icongroup1">
</div>
<br />
<script type="text/javascript">
var faq=new switchicon("icongroup1", "div") //Limit scanning of switch contents to just "div" elements
faq.setContent(0, 'xx.htm') //specify remote content for 1st header's content
faq.setContent(1, 'xxx.htm') //specify remote content for 2nd header's content
faq.setHeader('<img src="minus.gif" />', '<img src="plus.gif" />') //set icon HTML
faq.collapsePrevious(true) //Allow only 1 content open at any time
faq.setPersist(false) //No persistence enabled
faq.defaultExpanded(0) //Set 1st content to be expanded by default
faq.init()
</script>
but it doesnt seem to work. I have the two js scripts in the head. Do I need to adjust anything for the ajx to work, or do I need another js file? I cannot see a faq.setContent variable in the js files.
Thanks for any pointers.
Richard
http://www.dynamicdrive.com/dynamicindex17/switchcontent2.htm
Hi, I have set this script up but i cannot get the ajaxt bit to work.
I have
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title></title>
<link rel="stylesheet" type="text/css" href="css/new.css">
<script type="text/javascript" src="js/switchcontent.js" ></script>
<script type="text/javascript" src="js/switchicon.js"></script>
</head>
<h2>Demo 1:</h2>
<p><a href="javascript:faq.sweepToggle('contract')">Contract All</a> | <a href="javascript:faq.sweepToggle('expand')">Expand All</a></p>
<div class="eg-bar"><span id="faq1-title" class="iconspan"><img src="minus.gif" /></span>What is JavaScript?</div>
<div id="faq1" class="icongroup1">
</div>
<br />
<div class="eg-bar"><span id="faq2-title" class="iconspan"><img src="minus.gif" /></span>Difference between Java & JavaScript?</div>
<div id="faq2" class="icongroup1">
</div>
<br />
<script type="text/javascript">
var faq=new switchicon("icongroup1", "div") //Limit scanning of switch contents to just "div" elements
faq.setContent(0, 'xx.htm') //specify remote content for 1st header's content
faq.setContent(1, 'xxx.htm') //specify remote content for 2nd header's content
faq.setHeader('<img src="minus.gif" />', '<img src="plus.gif" />') //set icon HTML
faq.collapsePrevious(true) //Allow only 1 content open at any time
faq.setPersist(false) //No persistence enabled
faq.defaultExpanded(0) //Set 1st content to be expanded by default
faq.init()
</script>
but it doesnt seem to work. I have the two js scripts in the head. Do I need to adjust anything for the ajx to work, or do I need another js file? I cannot see a faq.setContent variable in the js files.
Thanks for any pointers.
Richard