Reputation Activity
-
Codiacz.com reacted to andy9l in jQuery, points count upHa! I know the sort, believe me. It's like, if they know the answer...you definitely should too. It's not just web development, it's even worse with more serious programming languages.
Anyway, no probs. Good luck
-
Codiacz.com reacted to andy9l in jQuery, points count upAh, here you go:
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $(function () { var scoring = false; function countTo(elem, current, incr, to) { scoring = true; to = to > 0 ? to : current + incr; if (++current <= to) { $(elem).html(current); setTimeout(function () { countTo(elem, current, incr, to); }, 5); } else { scoring = false; } } $("#score").click(function () { if (!scoring) { countTo($("#counter"), parseInt($("#counter").html()), 250); } }); }); </script> </head> <body> <p>Score: <span id="counter">0</span> </p> <button id="score">Score +250!</button> </body> </html>
-
Codiacz.com reacted to andy9l in jQuery, points count upRandomise in jQuery. Very similar to Vanilla JS so you can re-use the function easily...I assume you won't be just calling it after a button click!
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <script type="text/javascript"> $(function () { var scoring = false; function randomiseTo(elem, value, maxValue, maxIterations, curIterations) { curIterations = curIterations == null ? 0 : curIterations; scoring = true; if (++curIterations <= maxIterations) { $(elem).html(Math.floor(Math.random() * (maxValue + 1))); setTimeout(function () { randomiseTo(elem, value, maxValue, maxIterations, curIterations); }, 50); } else { $(elem).html(value); scoring = false; } } $("#score").click(function () { if (!scoring) { randomiseTo($("#counter"), 250, 999, 50); } }); }); </script> </head> <body> <p>Score: <span id="counter">0</span> </p> <button id="score">Score 250!</button> </body> </html>
-
Codiacz.com reacted to andy9l in jQuery, points count upJust whipped this up - obviously tidy up the JS a little, but should give you something to work from. Works for me, but I just tested very quickly in Safari
<!DOCTYPE> <html> <head> <script type="text/javascript"> function countTo(elem, current, to){ if (++current <= to){ elem.innerHTML = current; setTimeout(function(){ countTo(elem, current, to); }, 5); } } function randomiseTo(elem, value, maxValue, maxIterations, curIterations){ curIterations = curIterations == null ? 0 : curIterations; if (++curIterations <= maxIterations){ elem.innerHTML = Math.floor(Math.random() * (maxValue+1)); setTimeout(function(){ randomiseTo(elem, value, maxValue, maxIterations, curIterations); }, 50); } else { elem.innerHTML = value; } } </script> </head> <body> <p>Counter: <span id="counter"></span></p> <button onclick="countTo(document.getElementById('counter'), 0, 100)">Count to 100</button> <button onclick="randomiseTo(document.getElementById('counter'), 100, 999, 50)">Randomise to 100</button> </body> </html>
Edit: Mis-read what you wanted, think you'll find it somewhere in there now
Edit 2: If you want that in jQuery let me know.
Edit 3: Three edits?! Did you want it to randomise each individual number? Let me know, fix that up tomorrow. I'm tired, and it's showing!
-
Codiacz.com reacted to andy9l in Auto Suggest Search Dropdown PHP/jQuery v1Like it, clever anti-spam too
-
Codiacz.com got a reaction from andy9l in Auto Suggest Search Dropdown PHP/jQuery v1Just thought I would share a little project I been working on, feedback would be great thanks everyone.
Does basically what any big search engine does.
Check it out
-
Codiacz.com reacted to andy9l in Auto Suggest Search Dropdown PHP/jQuery v1Quite nice - what's the rank being based on?
Does it only search the first two letters? I tried 'testing' and got this (Safari 6):
-
Codiacz.com reacted to WildFire in sql data generatorsWhat about DBMonster?
http://sourceforge.n...ects/dbmonster/
-
Codiacz.com reacted to Jay Gilford in wamp function GETDATE()getdate isn't a mysql function. I think the one you need is curdate()
-
Codiacz.com reacted to webdeveloper93 in Bit of help with sessions and keeping the user logged in until logged out.ur header redirect should have an exit(); below it to be sure the rest of the script cant run incase the redirect fails for some reason
-
Codiacz.com reacted to Samus in How to dynamically fill DIVYep I got an example setup here.
jQuery:
$(document).ready(function(){ var nav = $("li.navlist"); // make this the selector that triggers the load var content = $("#main"); // make this the id of the container that you want the content to load in. nav.click(function(){ switch(this.id){ case "about": content.slideUp('slow', function() { content.load("about.html"); content.slideDown(); }) break; case "web": content.slideUp('slow', function() { content.load("web.html"); content.slideDown(); }) break; case "graphic": content.slideUp('slow', function() { content.load("graphic.html"); content.slideDown(); }) break; } });
HTML
<ul> <li class='navlist' id='about'> <a href='#' class='nav'>About Me</a> </li> <li class='navlist' id='web'> <a href='#' class='nav'>Web Portfolio</a> </li> <li class='navlist' id='graphic'> <a href='#' class='nav'>Graphic Portfolio</a> </li> </ul>
Basically it uses the id of your selector as the expression to evaluate in your switch statement. When there's a match it uses slideUp() to hide the original content in the div, it then uses load() to load the specified page, then uses slideDown to make the new loaded appear.
You can of course use other effects such as fadeIn(), fadeOut(), etc.
-
Codiacz.com reacted to mantis in I like this...jquery. page turning
-
Codiacz.com reacted to CSN-UK in PHP SearchIt looks at though you are looking for full text search, as such give this http://tips4php.net/2010/03/create-your-own-fulltext-searchengine-with-php-and-mysql/ a quick read and try, it has a few extra features that might interest you.
Feel free to report back if its not quite right or you have any issues
-
Codiacz.com reacted to RobbieD90 in Heart Internet VPS - Competition WinnerStill would of been nice either way wouldn't it though.
-
Codiacz.com reacted to RobbieD90 in Heart Internet VPS - Competition WinnerAlthough the winner doesn't seem to be very active in the forum are they?
Would of been nice if it had gone to someone who contibutes a little more that all I will say on the matter.
-
Codiacz.com reacted to BlueDreamer in Where to test my template ?There a many online services or applications that can help here if you look. http://speckyboy.com/2010/04/12/mobile-web-and-app-development-testing-and-emulation-tools/ has a summary, here's a few more sites I found with a simplet Google search
http://webdesignledger.com/tools/7-useful-tools-for-mobile-website-testing
http://sixrevisions.com/tools/10-excellent-tools-for-testing-your-site-on-mobile-devices/
-
Codiacz.com reacted to CSN-UK in PHP SearchHi Codiacz,
Your issue isn't so much your code, but instead your logic, and as such is an easy fix, I'll explain:
Your while loop for all intensive purposes is an If statement that repeats, as such if no results are found the following statement will evaluate false:
while($row_search=mysql_fetch_array($result_search)){}
and as a result the below block of code will not execute:
$check_search=mysql_num_rows($result_search); $name = $row_search['name']; $id=$row_search['id']; if($check_search < 1){ echo "No results for ".$s; } echo "<ul>\n"; echo "<li>" . "<a href=\"page.php?id=$id\">".$name."</a></li>\n"; echo "</ul>";
This means your if statement to show no results will never be executed as there will always be results if that block of code is executed, as such you need to move your if statement.
With these changes made see below:
<?php $s = $_GET['search']; $sql_search="SELECT id, name, FROM table WHERE name LIKE '%".$s."%'"; $result_search=mysql_query($sql_search); if (mysql_num_rows($result_search) >= 1) { // If we have 1 or more results execute this code while($row_search=mysql_fetch_array($result_search)){ $check_search=mysql_num_rows($result_search); $name = $row_search['name']; $id=$row_search['id']; echo "<ul>\n"; echo "<li>" . "<a href=\"page.php?id=$id\">".$name."</a></li>\n"; echo "</ul>"; } }else{ // We have no results echo "No results for ".$s; } ?>
Note: It is always good practice to check if a result is returned before attempting to work with it (the count if statement) to save yourself errors (log file) and also I would advise using full variable names vs $s ... as therse can be hard to remember if you have to pick up the script in 6 months time.
-
Codiacz.com got a reaction from oakleaves in Which is best? Have your vote.Wow not very friendly on this forum what's that about then! Can't believe really that you would take the time to write out your reply just to say or this is stupid why do this just what I child would do to which you are trying to compare me too. Now am not getting involved with your problem you have for me. I'll just leave it at that.
-
Codiacz.com reacted to oakleaves in Which is best? Have your vote.Tom & Jerry
-
Codiacz.com reacted to Renaissance-Design in Free Comment System jQuery/Ajax V1I think that instead of self-hosting free downloads you should host them somewhere like GitHub. You can always post about new releases etc, but GitHub will make it a lot easier to track versions and for other people to use and fork your code.