Skip to content

Instantly share code, notes, and snippets.

@clintandrewhall
Created July 4, 2011 02:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clintandrewhall/1062831 to your computer and use it in GitHub Desktop.
Save clintandrewhall/1062831 to your computer and use it in GitHub Desktop.
Learning code.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css" />
<title>QnA</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
</head>
<body>
<div id="container" class="clearfix">
<div id="header">
<h1>Q and A<h1>
</div><!--#header-->
<div id="sidebar">
<div id="main_clock" class="clock">
<p>00:00</p>
</div><!--#left_clock .clock-->
<ul>
<li><a href="#">revenue</a></li>
<li><a href="#">model</a></li>
<ul>
</div><!--sidebar-->
<ul id="qlist" class="clearfix">
<?php include_once('buildlist.php'); ?>
</ul><!--#qlist-->
<form id="myform" style="float:left;" class="clearfix" action="">
Question: <input class="clearfix" type="text" name="question" />
<input type="submit" name="submit" value="submit">
</form>
<div id="green">test</div>
<div id="blue">test</div>
</div><!--#container-->
</body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
<script type="text/javascript">
function setupLinks() {
$("#qlist a").click(
function() {
if($(this).next(".qmenu").css("display") == "none") {
$(".qmenu").slideUp();
$(this).next(".qmenu").slideDown();
}
else
{
$(this).next(".qmenu").slideUp();
}
}
);
}
$(document).ready(function(){
$("#qlist").sortable({handle:'div.handle', revert: true});
$("#green").toggle(
function(){$(this).animate({right:0},1000);},
function(){$(this).animate({right:-470},1000);}
);
$("#blue").toggle(
function(){$(this).animate({bottom:0},1000);},
function(){$(this).animate({bottom:-300},1000);}
);
setupLinks();
var myCount = 0;
$(".qclock").click(
function(){
var objClock = $(this);
filler = ""
if (myCount < 1){
myCount = myCount + 10;
thecount = setInterval(function(){newCount(objClock)}, 1000);
}
else
{
myCount = myCount + 10;
}
}
);
$(".qmenu a").click(
function() {
var qname = $(this).attr('name');
qname = qname.substr(1);
alert(qname);
}
);
$("#main_clock").click(
function(){
var objClock = $("#main_clock");
filler = ""
if (myCount < 1){
myCount = myCount + 10;
thecount = setInterval(function(){newCount(objClock)}, 1000);
}
else
{
myCount = myCount + 10;
}
}
);
$("#myform").submit(
function(event) {
/* stop form from submitting normally */
event.preventDefault();
$.post('inputQ.php', $("#myform").serialize(), function(data) {
$('#qlist').html(data);
setupLinks();
});
}
);
function newCount(objClock)
{
if(myCount < 10) {filler = "0"}
objClock.html("00:" + filler + myCount);
if (myCount < 1){
clearInterval (thecount);
filler = "";
}
myCount--;
};
});
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment