JavaScript - Need Some Help Real Fast
Code:
import java.util.Scanner; //This program does math public class Final { public static void main(String []args) { Scanner in=new Scanner(System.in); System.out.println("One last test"); System.out.print("Enter your birthday (mm/dd/yyyy): "); String roar=in.nextLine(); int n1=Integer.parseInt(roar); String date; String month, day, year; String ox=in.nextLine(); String[] s = ox.split("/"); for( String str : s); System.out.println("You were born on"+day+month+year); } } That is what i have so far, but i need to declare the day, month and year..can anyone help me? Similar TutorialsHi everyone, Someone made a website for my uncle, now he is telling me to fix a problem with it. The problem is that he made a type of image posting system/script on the right bottom of the page{You can see it in the attached image} and its not working at all. The address of website is http://www.signsgifts.com/ [IMG][img=http://s7.postimage.org/69zoetnsn/Screenshot_at_2012_05_03_15_28_28.jpg][/IMG] I am new to developing.. Thanks This script has been around a while (I know it's old) but it works in IE when you mouseover an image...you can make text scroll up or down. The problem is it goes pretty fast, even if you use the lowest speed (1). Is there a way to slow it down. Or a better script lying around anywhere? Code: function verScroll(dir, spd, loop) { loop = true; direction = "up"; speed = 10; scrolltimer = null; if (document.layers) { var page = eval(document.contentLayer); } else { if (document.getElementById) { var page= eval("document.getElementById('contentLayer').style"); } else { if (document.all) { var page = eval(document.all.contentLayer.style); } } } direction = dir; speed = parseInt(spd); var y_pos = parseInt(page.top); if (loop == true) { if (direction == "dn") { page.top = (y_pos - (speed)); } else { if (direction == "up" && y_pos < 10) { page.top = (y_pos + (speed)); } else { if (direction == "top") { page.top = 10; } } } scrolltimer = setTimeout("verScroll(direction,speed)", 1); } } function stopScroll() { loop = false; clearTimeout(scrolltimer); } EXAMPLE: <a href="#" onmouseover="verScroll('up',' 1 ','true')" onmouseout="stopScroll()" style="text-decoration: none"> <span class="1"> ◄◄ </span></a> Hi, I'm having a problem with a website I'm creating for christmas, in my family we always write santa claus letters but with a tricky side to it. So I decided to make questions on a website, the problem is that when the correct answer is given the javascript alert that is supposed to tell the user something appears and disappears without interaction from the user. I need the user to have to click OK. By the way, this only happens when using Mozilla. I have pulled this javascript text rotation from a simple tutorial. I can't figure out how to get the rotation speed to slow down. I think I need another variable but not really sure. Any help would be great. This is what I have: Code: <script type="text/javascript"> if (document.all || document.getElementById){ //if IE4 or NS6+ document.write('<style type="text/css">\n'); document.write('.dyncontent{display: none; width: 250px; height: 60px;}\n'); document.write('</style>'); } var curcontentindex=0; var messages=new Array(); function getElementByClass(classname){ var inc=0; var alltags=document.all? document.all : document.getElementsByTagName("*"); for (i=0; i<alltags.length; i++){ if (alltags[i].className==classname) messages[inc++]=alltags[i]; } } function rotatecontent(){ //get current message index (to show it): curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0; //get previous message index (to hide it): prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1; messages[prevcontentindex].style.display="none"; //hide previous message messages[curcontentindex].style.display="block"; //show current message } window.onload=function(){ if (document.all || document.getElementById){ getElementByClass("dyncontent"); setInterval("rotatecontent()", 2000); } } </script> I just wrote some javascript with a counter to call an ajax call of many records, but when it is around the 50th record the counter variable is not updating in time for the next ajax call resulting in duplicate results cause ajax is pullin the previous query again
I need to figure out a way to manipulate the arguments or functions or something somehow to have overloaded functions in JS. All I have found so far is people making like a switchboard function that directs the arguments based on the data, but not true overloading in that there is something like Function(input1) Function(input1,input2) Function(input1,input2,input3) And then you could call it with Function(x,y) or like Function(x,y,z) and hit the different functions. Any ideas? Edit: I was told to look at Functional Prototyping, which I understand the prototyping to be basiclly the parent from which others are made from. I don't see how it fits with overloading. Hi How to hide the real url and dispaly to specific url on a website. i.e. http://www.myapp.com/information.jsp is real url and want to dispaly http://www.myapp.com/ URL on browser. I will display as static URL instaead of real url. Please give an idea sugegstion how to do this bcoz I m new in JS. Thanks Lalit Okay i started a cople of days dont have experience in coding on JavaScript I need to make search button like this ) but i doesn't work. The idea is i add words or something to an array and after i enter the word or something press search and it gives the position in array. Code: var m = new Array(); function add() { var q = document.getElementById('mEntry'); var temp = q.value ; m.push(temp); } function test() { } function search() { var d = document.getEntryById('searchEntry'); var compare = d.value; var i=0; for (i=0;i<=m.lenght;i++) { if( m[i] = compare) document.write(i); } } ------------- This works just fine ) Code: var m = new Array(); function add() { var q = document.getElementById('mEntry'); var temp = q.value ; m.push(temp); } function test() { } function search() { var sEntry = document.getElementById('searchEntry'); var key = sEntry.value ; for(i in m) { if(m[i] = key) {var answer = i;} } document.write(answer); } Hi everyone, hope you can help. I've got a JS events calendar on my website, and on one of the entries I want the ticket link not to appear until a certain time & date (9:30am, Fri 29 Apr 2011, UTC+1). I've written the code for this to work: Code: var releasetime = 1304065800000 var currentdate = new Date() var currenttime = currentdate.getTime() if (currenttime >= releasetime){ document.write("<a href=\"ticket link\" rel="nofollow" target=\"_blank\">BUY TICKETS</a>") } And that's all good and working fine. EXCEPT, because it's taking the time & date from the local machine, all the user has to do is change the date on his PC to be able to see the ticket link. Is there any way to get the *actual* date & time? Thanks Cliff I need to make a counter that counts up (preferably in real time but not crucial). Ideally, it would count up by 9 dollars per second and go to the hundred millions. Thanks in advance! One that I have seen is at www.costofwar.com This is in real time, but that feature is not crucial. in the function emailTest in this code I can't seem to get the FIRST if statement to pass even if I put 1 in the in the email.value text box. even if i change the if condition to (email.value=="1") or (email.value=="a") and make the email.value text field equal respectively, IT STILL WON'T PASS only if I do (1==1) will it work. ----some background---- I was making a javascript form checker and i needed to test if the email field was an email. First I tried using an isEmail function. Didn't work. But the funciton seemed legitimate. I tinkered for hours trying to find glitches (it's simple regular expressions... i mean how hard could I screw it up?) and then eventually made the function return true by default so that the function would do nothing more but return true. Even when the function JUST returned true. (i also tried just returning 1) it still didn't pass. Then I took the function out of the if statement all together and tried the regular expression test in the if function. that didn't work. Now I'm trying to compare the variable directly to something simple. AND IT STILL DOESN'T WORK. WHAT is going on here people? REALLY ... I mean REALLLY/!?!? I've been programming for 7 GD years of my GD life (not javascript honestly) and SIMPLE CODE SHOULDN'T FAIL THIS HARD. Code: function emailTest() { if (email.value==1) { emailErrorBox.innerHTML="Please insert a valid email"; emailSuccessBox.innerHTML=""; } if (email.value.length>0 && email.focus) { emailErrorBox.innerHTML="";emailSuccessBox.innerHTML=""; request.abort(); var url = "/unseen/checkIfEmailExist.php?email=" + email.value; request.open("GET", url, true); request.onreadystatechange = updateEmailCheck; request.send(null); } if (email.value.length===0) {emailErrorBox.innerHTML="Please insert an email";emailSuccessBox.innerHTML="";} } If you go to http://freetexthost.com/dgbgshkzkj that is my code. It's a lot. I can't just give you a portion because I think it's something on the large scope that is screwing me up. This entire thing has me furious because IT IS SIMPLE CODE THAT REFUSES TO WORK... LITERAL REFUSAL THE COMPUTER JUST SAID NO NO NO NO. I am SERIOUSLY trying to get rolling on this project but some hidden syntax of javascript is blocking me from having these functions work correctly Hello, I have an existing php contact form which incorporates php validation (required name with only characters, valid email address format, and minimum message length) and re-captcha. I would like to add some "real time" validation to the fields on my form (there are 3 fields - name, email and message) before the "Submit" button is pressed. For example when the user tabs from one text box to the next but hasn't filled in the required information. I am totally new to any type of java, but am I right in thinking I need either JavaScript, Ajax or JQuery to perform real-time validation? If so, which should I be looking into and are there any basic examples of form validation? I want to keep my pup validation as I'm aware that php is client-side but still needed as people can turn Java off in their web browsers. Any tips and pointers will be very much appreciated! Thankyou, Tom Ok Need Help Here. As I post earlier how to detect firefox before let the user in some guys just disable javascript and went in I finding solution i think of it but i dun know the code not sure is it working Script that allow the browser to check weather javascript is ON if not cannot grant access to the page . Another thing is by using a image means when i enter the site it will show a image i will need to click it before it enter the content of the pages i think that a javascript code i seen it somewhere else about months ago. 1 down vote favorite I do have the countdown script (see link below) to display the time between current time and the date given in real-time. However, I want to achieve to display the time difference between a given start and end time. Right now, it calculates from the current server time to the end time. I want to be able to set up my own start time and end time. Here is what I have: http://jsfiddle.net/BgEtE/ thank you for help Hi all Is using the real form submit button a problem in any way? Can it actaully send a form when a person uses 'enter' in a text field. When I use this submit, it triggers my validation which is great. Code: <input type="submit" value="OnSubmit validate" /> However this way doesn't seem to trigger my validation although It may solve the above form send problem (if that realy exists). How do I get it to act the same as real submit so it will trigger validation like onsubmit above? Code: <input type="button" value="Send Feedback" onclick="this.form.submit()" /> LT does any of that make sense? all ideas helpful and appreciated |