JavaScript - This Is The Most Amazing Thing I've Ever Seen, Please Help Me Duplicate It
OMG, Check out the background on this site... http://paulirish.com/ how would I even start to rip that for use on my own site? I'll pay someone $15 on paypal if they can make a css and js file that I can just link too and have this background
Similar TutorialsI need to know how to subtract a number which selecting an option from checkboxes. As seen in picture below. Basically you have a maximum of 10 stats to select. If you select say 3 Strength, I need the 10 to change to a 7, and it changes on each new value the select boxes have. So when they equal 10, it'd show a red 0 remaining. I'd prefer some way of not allowing more than a maximum of 10 from being selected, but don't know if thats even possible. Thanks for any help! Code: <h2>Starter Stats</h2> <ul> <li>You have <b>10</b> stats remaining.</li><br /> <li> <table width="75%"> <tr><td> <b>Focus</b></td><td><select name="focus"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td> <b>Attack</b></td><td><select name="attack"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td> <b>Defense</b></td><td><select name="defense"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td> <b>Dexterity</b></td><td><select name="dexterity"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> <tr><td> <b>Magic Defense</b></td><td><select name="magicdefense"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select></td></tr> </table> I know very little JavaScript (I can modify a script slightly, but I can't write one), so I am asking for your help. I want to place a textarea on a web page. This textarea would have attributes to make it so that if you pressed "i", it would come out as "c", or if you pressed "]" it would appear as "=", and so on. (If you're wondering, I want to make it work like the Dvorak keyboard layout). I also would like a button to copy the text in the textarea to the clipboard. Thank you in advance for your help! Jordon HI evey one I want to make a vote music web site , some thing like this : http://www.pmctop20.com/ we can drag each of the items in the left panel and drag it to the vote rows . How can I do so? It's a jquery script Thanks How could a make a html button that each time your press it it does a new things?
when i try to run this it always says INPUT FROM A FILE. a file can have more than one birthday at it will be output also to a file. sorry for my bad english Code: import java.util.*; public class ZodiacSign { public static void main(String[] args) { String sign=""; String element=""; String chineseSign=""; int month, day,year; Scanner c = new Scanner (System.in); System.out.println("Enter day(1-31): "); day = c.nextInt(); System.out.println("Enter month(1-12): "); month = c.nextInt(); System.out.println("Enter year: "); year = c.nextInt(); if((month == 1) && (day <= 20) || (month == 12) && (day >= 22)) { sign = "Capricorn"; } else if((month == 1) || (month == 2) && (day <= 19)) { sign = "Aquarius"; } else if((month == 2) || (month == 3) && (day <= 20)) { sign = "Pisces"; } else if((month == 3) || (month == 4) && (day <= 19)) { sign = "Aries"; } else if((month == 4) || (month == 5) && (day <= 21)) { sign = "Taurus"; } else if((month == 5) || (month == 6) && (day <= 21)) { sign = "Gemini"; } else if((month == 6) || (month == 7) && (day <= 23)) { sign = "Cancer"; } else if((month == 7) || (month == 8) && (day <= 23)) { sign = "Leo"; } else if((month == 8) || (month == 9) && (day <= 23)) { sign = "Virgo"; } else if((month == 9) || (month == 10) && (day <= 23)) { sign = "Libra"; } else if((month == 10) || (month == 11) && (day <= 22)) { sign = "Scorpio"; } else if(month == 12) { sign = "Sagittarius"; } if((sign.equals("Aries"))||(sign.equals("Leo"))||(sign.equals("Sagittarius"))){ element="Fire"; } else if((sign.equals("Taurus"))||(sign.equals("Virgo"))||(sign.equals("Capricorn"))){ element="Earth"; } else if((sign.equals("Gemini"))||(sign.equals("Libra"))||(sign.equals("Aquarius"))){ element="Air"; } else if((sign.equals("Cancer"))||(sign.equals("Scorpio"))||(sign.equals("Pisces"))){ element="Water"; } int x = (1997 - year) % 12; if ((x == 1) || (x == -11)){ chineseSign="Rat"; } else{ if (x == 0){ chineseSign="Ox"; } else{ if ((x == 11) || (x == -1)){ chineseSign="Tiger"; } else{ if ((x == 10) || (x == -2)){ chineseSign="Rabbit"; } else{ if ((x == 9) || (x == -3)){ chineseSign="Dragon"; } else{ if ((x == 8) || (x == -4)){ chineseSign="Snake"; } else{ if ((x == 7) || (x == -5)){ chineseSign="Horse"; } else{ if ((x == 6) || (x == -6)){ chineseSign="Sheep"; } else{ if ((x == 5) || (x == -7)){ chineseSign="Monkey"; } else{ if ((x == 4) || (x == -8)){ chineseSign="Chicken"; } else{ if ((x == 3) || (x == -9)){ chineseSign="Dog"; } else{ if ((x == 2) || (x == -10)){ chineseSign="Pig"; } } } } } } } } } } } } System.out.println("Your Zodiac sign is "+sign+"."); System.out.println("Chinese Zodiac is: "+chineseSign+"."); System.out.println("Element is "+element+"."); } } Code: var c=0; var i=0; function timedCount() { document.getElementById('txt').innerHTML=c; c++; setTimeout("timedCount()",500); } function expand() { while (i<=10) { timedCount(); i++; } } For some reason the innerHTML number starts at 10 because of the while. I want it to start from 0 and stop when at 10... How would I clean up this code? it looks so ugly, would I put it in a for loop and make it loop through and set the rand2, rand3, rand4 = place... there so there is a lot less lines of code(which is what I want) I need a cleaner way to do this, so it isn't so much space. Can someone help? there needs to be different variables because I need the random to be different for each, so rand2 = different random value than rand3. var place = [74,111,148,185,222,259,296,333,370]; var random = [rand,rand2,rand3,rand4,rand5,rand6,rand7,rand8,rand9]; var rand = place[Math.floor(Math.random()*place.length)]; var rand2 = place[Math.floor(Math.random()*place.length)]; var rand3 = place[Math.floor(Math.random()*place.length)]; var rand4 = place[Math.floor(Math.random()*place.length)]; var rand5 = place[Math.floor(Math.random()*place.length)]; var rand6 = place[Math.floor(Math.random()*place.length)]; var rand7 = place[Math.floor(Math.random()*place.length)]; var rand8 = place[Math.floor(Math.random()*place.length)]; var rand9 = place[Math.floor(Math.random()*place.length)]; var newrand = place[Math.floor(Math.random()*place.length)]; var newrand1 = place[Math.floor(Math.random()*place.length)]; var newrand2 = place[Math.floor(Math.random()*place.length)]; var newrand3 = place[Math.floor(Math.random()*place.length)]; var newrand4 = place[Math.floor(Math.random()*place.length)]; var newrand5 = place[Math.floor(Math.random()*place.length)]; var newrand6 = place[Math.floor(Math.random()*place.length)]; var newrand7 = place[Math.floor(Math.random()*place.length)]; var newrand8 = place[Math.floor(Math.random()*place.length)]; var newrand9 = place[Math.floor(Math.random()*place.length)]; var old = place[Math.floor(Math.random()*place.length)]; var old1 = place[Math.floor(Math.random()*place.length)]; var old2 = place[Math.floor(Math.random()*place.length)]; var old3 = place[Math.floor(Math.random()*place.length)]; var old4 = place[Math.floor(Math.random()*place.length)]; var old5 = place[Math.floor(Math.random()*place.length)]; var old6 = place[Math.floor(Math.random()*place.length)]; var old7 = place[Math.floor(Math.random()*place.length)]; var old8 = place[Math.floor(Math.random()*place.length)]; var old9 = place[Math.floor(Math.random()*place.length)]; So I am working on a project to take an integer that the user gives, and then get all the squares and cubes of all the numbers before that to the number given. It displays it in a text area. Maybe I am just lost for the moment, but It just prints the number that I give with the square root and cube instead of starting from 1, and ended on the integer I give. Code: var square_cube = function (){//This f var number = parseInt($("maxbase").value); for (var i=1;i <= number;i++) { var squ = Math.pow(i,2); } var j; for (j=1;j<=number;j++) { var cub = Math.pow(j,3); } var message = i-1 + " " +squ+ " " +cub; $("powers").value = message; } Hello Guys and Gals, I have got my head around using the jquery validate and submit without refresh and implemented it successfully on a front end form. Now I would like to streemline backend updating by enabling submit without refresh for multiple items on a page, validation would be nice but less important. what I would like to do is something like adding 'here' to the function and 'this' to the form but im not sure how exactly. here is the code im using Code: <title>Untitled Document</title> <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'></script> <script type="text/javascript" src="js/jquery.validate.js"></script> <script type="text/javascript" src="js/jquery.form.js"></script> <script type="text/javascript"> $('document').ready(function(){ $('#form').validate({ rules:{ // your validation rules }, messages:{ // and validate msgs }, submitHandler: function(form){ $(form).ajaxSubmit({ target: '#preview', success: function() { // take these lines out if you dont want to hide the form after submit $('#formbox').slideUp('slow'); ///////////////// } ///////////////////////////////////////////// }); } }) }); </script> </head> <div id="preview"> </div> <div id="formbox"> <form id="0" name="0" method="post" action="timbersend.php" > <label>name</label> <input type="text" name="name" /> <label>value</label> <input type="text" name="value" /> <input type="submit" value="submit" name="submit" /> </form> </div> <body> </body> thanks steve disregard...i got it
Hi, on my page below: http://www.jbiddulph.com/helix/events.html I have a navigation of 1,2,3,4,5which when a user clicks on a different number the image changes, I need to have this navigation for the 4 other large boxes underneath?! I can't work out how to go about this?! please help here is the code to the page Code: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Helix</title> <link type="text/css" rel="stylesheet" href="css/reset.css"> <link rel="stylesheet" type="text/css" href="css/style.css" title="default" /><!--[if lte IE 7]> <style type="text/css"> html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/ </style> <![endif]--> <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script> <script type="text/javascript" src="js/jquery.cycle.all.min.js"></script> <script type="text/javascript"> $(function() { $('#slideshow').after('<div id="nav" class="nav">').cycle({ fx: 'fade', speed: 'fast', timeout: 0, pager: '#nav', befo onBefore }); function onBefore() { $('#title').html(this.alt); } }); </script> </head> <body> <div id="top"> <div id="topwrapper"> <div id="logo"> </div> <ul id="rightnav"> <li><a href="index.html" title="Home">Home</a></li> <li><a href="news.html" title="News">News</a></li> <li><a href="archives.html" title="Archives">Archives</a></li> <li><a href="finishes.html" title="Finishes">Finishes</a></li> <li><a href="contact.html" title="Contact">Contact</a></li> </ul> <nav> <ul> <li><a href="events.html" title="HELIX EVENTS" class="menuselected">HELIX EVENTS</a></li> <li><a href="marketing.html" title="HELIX MARKETING">HELIX MARKETING</a></li> <li><a href="film.html" title="HELIX FILM & TV">HELIX FILM & TV</a></li> <li><a href="exhibitions.html" title="HELIX EXHIBITIONS">HELIX EXHIBITIONS</a></li> <li><a href="interiors.html" title="HELIX COMMERCIAL INTERIORS">HELIX COMMERCIAL INTERIORS</a></li> </ul> </nav> <div class="line"> </div> </div> </div> <div id="content"> <section id="slider" style="background-color: rgb(160, 191, 74);"> <div id="viewport"> <div id="container"> <div id="section-1" class="section"> <img src="images/slider_01.png"> </div> </div> </div> </section> <div class="line"> </div> <h1>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</h1> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p> <div class="dashedlinetop"> </div> <div id="box"> <div id="slideshow" class="pics"> <img src="images/box1.jpg" alt="1"/> <img src="images/box2.jpg" alt="2"/> <img src="images/box3.jpg" alt="3"/> <img src="images/box4.jpg" alt="4"/> <img src="images/box5.jpg" alt="5"/> </div> </div> <div class="dashedlinebottom"> </div> <div class="dashedlinetop"> </div> <div id="box"> <div id="slideshow" class="pics"> <img src="images/box1.jpg" alt="1"/> <img src="images/box2.jpg" alt="2"/> <img src="images/box3.jpg" alt="3"/> <img src="images/box4.jpg" alt="4"/> <img src="images/box5.jpg" alt="5"/> </div> </div> <div class="dashedlinebottom"> </div> <div class="dashedlinetop"> </div> <div id="box"> <div id="slideshow" class="pics"> <img src="images/box1.jpg" alt="1"/> <img src="images/box2.jpg" alt="2"/> <img src="images/box3.jpg" alt="3"/> <img src="images/box4.jpg" alt="4"/> <img src="images/box5.jpg" alt="5"/> </div> </div> <div class="dashedlinebottom"> </div> <div class="dashedlinetop"> </div> <div id="box"> <div id="slideshow" class="pics"> <img src="images/box1.jpg" alt="1"/> <img src="images/box2.jpg" alt="2"/> <img src="images/box3.jpg" alt="3"/> <img src="images/box4.jpg" alt="4"/> <img src="images/box5.jpg" alt="5"/> </div> </div> <div class="dashedlinebottom"> </div> <div class="dashedlinetop"> </div> <div id="box"> <div id="slideshow" class="pics"> <img src="images/box1.jpg" alt="1"/> <img src="images/box2.jpg" alt="2"/> <img src="images/box3.jpg" alt="3"/> <img src="images/box4.jpg" alt="4"/> <img src="images/box5.jpg" alt="5"/> </div> </div> <div class="dashedlinebottom"> </div> </div> <!-- end content --> </body> </html> I would like to count how many duplicate values I have in an array. My below attempt doesnt count the duplicate values: Code: var ct = 0; for(var i = 0;i < myArray.length;i++) { var myData = getData[i].city; if(myData == myData) { ct++; } alert("Total Count = " + ct); } Please advise the best way to do this. Hello Guys, im writing a big page with several different elements in it, and im stuck trying to duplicate a script. first one works "tab b" click each 'icon' and a .png file appears above it to show its selected. "tab c" same script and code seems to only work for first icon, and switch off when clicked on the others. been staring at this for sooooome time now, please can someone see what i have done wrong, as i dont really understand the code im using, im just a beginner. url is http://www.zakscustomcues.com/module...builder2.0.php much appreciated. steve Greetings and salutations. My text and what I have been researching on the internet has not been very helpful in determining the code that I need to prevent a user from entering his/her information more than once. Here is my current code Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD.HTML 4.01 Transitional//EN" "http://www.w3.org/TR/htm14/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Kudler Fine Foods Contact Page</title> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1"> <!---Kami Demnyan 21 December 2009--> <script type="text/javascript"> /*<![CDATA[*/ <!--This code ensures that the zip code and telephone numbers are actual numerical digits, not letters--> function checkForNumber(fieldValue) { var numberCheck = isNaN(fieldValue); if (numberCheck == true) { window.alert ("Please enter a numerical value"); return false; } } <!--This code ensures that all of the fields contain text and I have it functioning now--> function submitForm() { if (document.forms[0].name.value == "" || document.forms[0].address.value == "" || document.forms[0].city.value == "" || document.forms[0].state.value == "" || document.forms[0].zip.value == "" || document.forms[0].phone.value == "" || document.forms[0].email.value == "") { window.alert("Please enter your missing information"); return false; } else return true; } function getCookie(NameOfCookie) { if (document.cookie.length > 0) { begin = document.cookie.indexOf(NameOfCookie+"="); if (begin != -1) { begin += NameOfCookie.length+1; end = document.cookie.indexOf(";", begin); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(begin, end)); } } return null; } function setCookie(NameOfCookie, value, expiredays) { var ExpireDate = new Date (); ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000)); document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()); } function delCookie (NameOfCookie){ if (getCookie(NameOfCookie)) { document.cookie = NameOfCookie + "=" +"; expires=Tues, 02-Feb-10 00:00:01 GMT"; } } /*]]>*/ </script> </head> <body> <h1> KUDLER FINE FOODS </h1> <h2> JOIN OUR MAILING LIST</h2> <!--This is where the user will input all of their information to join the mailing list--> <form action="completeform.html" method="get" onsubmit="return submitForm();" enctype="application/x-www-form-urlencoded"> <p>Name<br /> <input type="text" name="name" size="50" /></p> <p>Address<br /> <input type="text" name="address" size="50" /></p> <p>City, State, Zip <br /> <input type="text" name="city" size="30" /> <input type="text" name="state" size="3" /> <input type="text" name="zip" size="10"; onchange="return checkForNumber(this.value)"; /></p> <p>Telephone<br /> <input type="text" name="phone" size="25" onchange="return checkForNumber(this.value)"; /></p> <p>Email Address<br /> <input type="text" name="email" size="50" /></p> <!--This is where the submit and reset buttons are located--> <p><input type="submit" value="Submit Form" /> <p><input type="reset" value="Reset Form" /> </form> </body> </html> I have created a new web page to link the duplicate cookie too, titled doubleinfo.html. This is what I am using to let the user know that their information has already been entered. My text is telling me that I need to look for a nextform() function, but I didn't have to write one so what would I need to do, if anything, to start the document.cookie = "name" codes? Any help would be greatly appreciated, thanks in advance. Is there a method or a way to duplicate the text typed in one textarea to another, with onkeyup or onchange? The problem I'm facing is with FCKeditor. Two textareas with loaded templates and the text has to be manually copied and pasted when changed. Code: <form action="" method="post" name="form1" id="form1"> Subject:<br /> <input type="text" name="subject" value="Subject" size="32" /> <br /> Main Article:<br /> <textarea name="content" cols="50" rows="10"> <?php echo $row['article']; ?> </textarea> <br /> Text version:<br /> <textarea name="content_text" cols="50" rows="10"> <?php echo $row['article']; ?> </textarea> <input type="submit" value="Send" /> </form> I may be going about this all wrong? Send newsletters, it all works - not sure? do I need the second texarea. Hi there It's huge problem for me but I don't think it is for many of you here. I have been asked at the college to make a manual lottery checker using javascript, but I found lots of problem during the coding. To make it more clear it's about 3 players they always play the same set of 6 number between 1 and 49. the players enter manually the winning number using a prompt which popup when you open the page (No button required for this, just simple prompt). each time you type duplicate number an alert tells that this number been entered, when the six number been successfully entered will ask for the bonus ball the same way but it should between 1 and 49 as well. When this done the program print out for each player the much numbers. This my peace of coding but I stucked in many bits in it. I need your knowledge guys in javascript to fix this for me. Code: <html> <head> <title>Lottery Checker</title> <h1>Lottery Checker</h1> </head> <body> <script type="text/javascript"> //Declare Variable var number1 = [3, 9, 18, 27, 30, 33]; var number2 = [5, 7, 11, 12, 34, 42]; var number3= [4, 15, 21, 23, 27, 31]; var drawNumber = []; var bonusBall = []; //Declare variable Times and Dates var currentTime = new Date(); var day = currentTime.toUTCString(); // Print out the player set numbers document.write("<h4>You visited the lottery website at :</h4>" + day); //Print out Times and Dates document.write('<p>Player number 1 : '+ number1 +'</p>'); document.write('<p>Player number 2 : '+ number2 +'</p>'); document.write('<p>Player number 3 : '+ number3 +'</p>'); //Copare Lottery Number arrays //Add input number using prompt to add the 6 bonus number and the bonus ball for (var i=0 ; i<=5 ; i++) { drawNumber[i] = prompt("Enter the Lottery draw Number."); drawNumber.sort(function(a, b){return a-b}); //Fix the lottery Numbers between 1 and 49 while (drawNumber[i]<1 || drawNumber[i]>49) { drawNumber[i] = prompt("The lottery Number should be between 1 and 49"); // to insert Prompt insteat the Alert } if (drawNumber[i] = drawNumber) // if statement to be checked again { alert('You already entered this number');// if statement to be checked again } } document.write('<p>The winning lottery number for this week: '+drawNumber+ ', The bonus number: '+ drawNumber[6] + '</p></br>'); //Sort the winning number by each player // Display the result for each player how many number much document.write('Player 1 winning numbers: ' + drawNumber +'</br>'); document.write('Player 2 winning numbers: ' + drawNumber +'</br>'); document.write('Player 3 winning numbers: ' + drawNumber +'</br>'); </script> </body> </html> Hi Experts, I have an online application form that a member submits to register with our organization. However I want to make sure that the member submits only one application form per session year. Is there anyway I could setup a java script that lets the member know that they have already submitted their application when they try to re-submit. The current setup lets them submit many applications which I am trying to prevent. Any help is greatly appreciated. Thanks Vinny i've written a js function to find the difference between two dates. the format being used is dd/mm/yyyy hh:mm. The function returns correct value when give one set of values, but go wrong with another set. examples are given below. set 1 : Time 1 = 24/02/2011 09:30 , time 2 = 24/02/2011 16:00 Output is corret here. It gives 6 Hours & 30 Minutes (after converting the difference) set 2: Time 1 = 24/02/2011 09:30 , time 2 = 25/02/2011 16:00 Here, it gives 31 days, 6 Hours & 30 Minutes. My code is given below. Also the alert of dates display strange values. Don't know if it is timezone issue. I wonder what is going wrong here Code: function compareDateTime(frmtime,totime) { var date1 = new Date(frmtime); var date2 = new Date(totime); var diff = new Date(); alert(date1); alert(date2); diff = (date2.getTime()-date1.getTime()); if (diff<0) { alert("From Time cannot be later than To Time!"); return 0; } else if (diff==0) { alert("From Time cannot be equal with To Time!"); return 0; } else { return diff; } } The returned diff value is broken down as following: Code: if (diff>0) { days = Math.floor(diff / (1000 * 60 * 60 * 24)); diff -= days * (1000 * 60 * 60 * 24); hours = Math.floor(diff / (1000 * 60 * 60)); diff -= hours * (1000 * 60 * 60); mins = Math.floor(diff / (1000 * 60)); alert(days+","+hours+","+mins); return true; } Please Help... |