
liamloveslearning
Members-
Posts
758 -
Joined
-
Last visited
Never
Everything posted by liamloveslearning
-
Javascript undefined onkeyup?
liamloveslearning replied to liamloveslearning's topic in Javascript Help
whoops, i was total was a variable so didn'r need the .value at the end! -
Hi all, having trouble with a simple equation, my javascript is returning undefined when I try to multiply 2 variables on keyup, my code is <html> <head> <script> function functionCalc() { // Content Minutes var conMin = document.getElementById('cMin'); var test = 10; // Service Levels var priorityMega = 0.84; var priorityUrgent = 0.67; var standardJob = 0.56; var scheduledJob = 0.28; var lightpassJob = 0.14; var total = conMin + test; document.getElementById("estDiv").innerHTML=total.value; } </script> </head> <body> <input type='text' id='cMin' onKeyUp="functionCalc()" /> <div id="estDiv"></div> </body> </html> Can anybody see why? Thanks
-
I've gotten it working using a numerical value as opposed to a php value so I think its something to do with my php variable? var credit = 2000; newbalance = newbalance+credit;
-
could i do something like this with my JS var credit = "<?php $row->coff ?>" newbalance = newbalance+credit;
-
Hi, Im working with an existing site for a friend at the moment and I've come across a bit of a problem, I need to pass an array value to a javascript file which I'm unsure of how to do, my php is... $rs = mysql_query("select users.id, twitterUser, coff from users where twitterUser != '' and users.id IN (select concat_ws(',', id) from users where id != ".$usersClass->userID().") and users.id NOT IN (select concat_ws(',', followedID) from activity where followerID = '".$usersClass->userID()."') and users.id NOT IN (select concat_ws(',', userid) from featured) ORDER BY credits DESC;") or die(mysql_error()); $nr = @mysql_num_rows($rs); if($nr != 0) { while($row=@mysql_fetch_object($rs)) { $divLeft = '<div class="user-box"><div class="twithandlepic"><img src="http://api.twitter.com/1/users/profile_image/'; $divRight = '<div class="twithandle">'; $clearDiv = '<div style="clear:both;"></div>'; print $divLeft.strip_tags($row->twitterUser)."?size=normal\"/><br \/>".$row->twitterUser.$divRight."<a href='javascript:void(0);' id='vote_$row->id' class='getPoint'>Get " .$row->coff. " credit(s)</a><br /></div>$clearDiv</div></div>"; } Now I have a function in my javascript which is carried out after an onClick event... newbalance = newbalance+1; What I need to do is somehow write "newbalance = newbalance+$row->coff;" Does this make sense?
-
nevermind, sorted should have used != ''
-
Hi all, having a strange problem with my query Its only returning some of my data, and in the format User 1 <br /> <br /> User 2 <br /> <br /> <br /> <br /> $newmembers = "SELECT * FROM users WHERE linked_user IS NOT NULL ORDER BY datejoined LIMIT 6"; $nmresult = mysql_query($newmembers); while($row = mysql_fetch_array($nmresult)){ echo $row['linked_user']; echo "<br />";} ?>
-
Hello, Im about to start building a calculator for a clients website only im unsure of the best way to do this, I was going to use PHP as I believe its much more secure only I feel its pretty advanced so decided to have it all clientside, despite the insecurities. I need a calculator which will generate a quote on the fly based on 3 different inputs, and then provide the quote. Ive posted a screenshot of my page which I hope will speak for itself... Thanks in advance
-
Hi everybody, im reading up on arrays and im still stuck... Is it possible to assign an array to a variable? I need something like... &needvariable = $row->User Hopefully this makes sense...
-
I've added a variable and assigned it a value var userofferedcredit = 1000; which now works when I add the two newbalance = newbalance+userofferedcredit; I just need to figure out how you assign the variable, a php value, could I use the document.write function to write the query?
-
Sorry requinix, Theres no such thing but I presumed the correct solution would be to write a query which gets it, and thats what user-offered-credit would have been...
-
Hello everybody, Very new to javascript so really stuck on this problem... The website im currently building and is credit based and users specify how many credits there willing to give to other users providing they complete a task, this could be to visit a link they post, or visit their website. For example John could offer 10 credits to anybody who clicks his link through to his portfolio, If james was to click this link he would then receive Johns 10 credits, and john would have them deducted... I have a table of users laid out as such... ID | Username | Credits 1 Tom 3 2 john 32 3 jack 52 At the moment i have a script which either +1 credits or +5 depending on the level of user, using the following script $(".getPoint").click(function() { var theid = $(this).attr("id"); var onlyID = theid.split("_"); var onlyID = onlyID[1]; $.ajax({ url: 'do.php', type: 'POST', data: "userID=" + onlyID, success: function(data) { if(data != "success1" && data != "success5") { $("#" + theid).text(data); }else{ $("#thediv_" + onlyID).fadeOut("slow"); $('#creditsBalance').fadeOut("slow"); newbalance = parseInt($('#creditsBalance').text()); if(data != "success5") { newbalance = newbalance+1; }else{ newbalance = newbalance+5; } $('#creditsBalance').text(newbalance); $('#creditsBalance').fadeIn("slow"); $("#" + theid).text("Done"); } }, beforeSend: function() { $("#" + theid).text("Working..."); }, error: function() { $("#" + theid).text("Failed...Click to Retry"); } }); }); What im asking is how do I change the line... newbalance = newbalance+1; to say... newbalance = newbalance+$user-offered-credit; Thanks for any help and I hope this makes sense!
-
Nevermind, couldnt see the forest for the trees
-
Hi All, Im having trouble with my update password script in the sense that it's not encrypting passwords in the MD5 format, I believe this is the line causing me problems, Can anybody tell me why? mysql_query("UPDATE users SET password='md5($newpword)' where username='$uname'");
-
Thanks Spiderwell, Ill need to store if they have paid and then the date they have paid, sorry, think Ive just answered my own question...
-
Hi all, first of all sorry if this is in the wrong board, im currently building a site which will charge an annual fee of X amount. I've never build something like this before so Ill be using paypal for ease of use and security, but how would you usually go about constructing the tables etc?
-
Hi all, I need to create a table which holds a list of values, for EG 1 PHP 2 MySQL 3 HTML 4 JS The reason im doing this is so when a user visits X page on my site, they are presented with a list of possible options which they can tick, for instance if you were asked what languages your fluent with you would tick HTML and JS (or w/e applies to you) What would be the best way of constructing the table? Thanks
-
Hi there Got a problem needs a solution, basically a booking system has been built (by me) and works great except for the checking availablity Basically they can do drives in a car (in any order) so I need to try all possible combinations. one idea I had was to use an array holding the availability for each slot so that it looks like slotArray=array("ABC","AC","C","A","BC","AB","ABC" ...etc) looking for drives A and B so check if slotArray[1] contains A and Slot Array 2 contains b or vice versa what i need to do is work out all the possible orders of a string ABCDE (there will be 120 of them) so I can systematically check the order anyone have a function that will do this?