Jump to content

Craig Hopson

Members
  • Content Count

    212
  • Joined

  • Last visited

Community Reputation

7 Neutral

About Craig Hopson

  • Rank
    Member
  • Birthday 11/01/1980

Previous Fields

  • Languages
    HTML, CSS, PHP(little)

Profile Information

  • Location
    London
  • Interests
    Web development takes all my time....
  1. ok got it just added "display:none" to the cell tags
  2. Thanks for the reply but that does'nt work with my code i dont need to hid a div just the table cells
  3. Hi guys using this code to hide table contents but how can i make the table hidden on page load $('.header').click(function () { var $this = $(this); $(this).nextUntil('tr.header').slideToggle(100).promise().done(function () { $this.find('span').text(function (_, value) { return value == '-' ? '+' : '-' }); });}); http://jsfiddle.net/y4Mdy/ Thanks
  4. it is coming from here #!/usr/bin/pythonimport sys, json, oslist = os.listdir("/sys/bus/w1/devices/")list.remove("w1_bus_master1")# we can also build lists, first start with an empty oneoutput = []for sensor in list: # Open the file that we viewed earlier so that python can see what is in it. Replace the serial number as before. tfile = open("/sys/bus/w1/devices/" + sensor + "/w1_slave") # Read all of the text in the file. text = tfile.read() # Close the file now that the text has been read. tfile.close() # Split the text with new lines (n) and select the second line. secondline = text.split("n")[1] # Split the line into words, referring to the spaces, and select the 10th word (counting from 0). temperaturedata = secondline.split(" ")[9] # The first two characters are "t=", so get rid of those and convert the temperature from a string to a number. temperature = float(temperaturedata[2:]) # Put the decimal point in the right place and display it. temperature = temperature / 1000 #print temperature output.append({ sensor:temperature })# Send it to stdout (to PHP)out = json.dumps(output,separators=(',', ':'))print out output for this is [{"prob2":23.75},{"prob1":23.625}]
  5. Hi guys my JS is poor at best i have this [Object { prob2=23.5}, Object { prob1=23.375}] showing in my console.log it comes from a AJAX request from PHP i'm getting this out put by this $.ajax({ url:"temps.php", dataType: "json", success:function(data) { console.log(data); } how can i use thi information like this??? $.ajax({ url:"temps.php", dataType: "json", success:function(data) { document.getElementById("prob1").innerHTML = data.prob1; } Please help cos this dont work lol Thanks
  6. i dont understand this is dropdown menus not selection boxes
  7. Hi guys, what i am looking for is 5 drop down boxes with 5 options. When one option is selected it then cant be selected in the other 4 drop downs and so on until eventually all 5 drop downs will have one off the 5 options i'm using bootstrap (hence posting in Javascript section), I'm shore there is a easy way to do this i just cant figure it out Thanks all
  8. Hi guys i'm prob going about this the wrong way but this is what i have so farThe HTML <div class="example"> <input type="radio" value="border-0" name="Border" id="text1" checked="checked"/> No Border </div> <div class="border-1 example"> <input type="radio" value="border-1" name="Border" id="text2" /> Single Line </div> <div class="border-2 example"> <input type="radio" value="border-2" name="Border" id="text3" /> Double Line </div> <div class="border-3 example"> <input type="radio" value="border-3" name="Border" id="text4" /> 3D Line </div> <div class="font-1 example"> <input type="radio" value="font-1" name="Font" id="text1" checked="checked"/> Normal Font </div> <div class="font-2 example"> <input type="radio" value="font-2" name="Font" id="text2" /> Font 2 </div> <div class="font-3 example"> <input type="radio" value="font-3" name="Font" id="text3" /> Font 3 </div> <div class="font-4 example"> <input type="radio" value="font-4" name="Font" id="text4" /> Font 4 </div><span id="regdisplay" class="">HELLO</span>The JS$(function() { $('[name=Border]').click(function() { var classy = $(this).val(); $('#regdisplay').removeClass(); if($(this).is(':checked')) { $('#regdisplay').addClass(classy); } });});$(function() { $('[name=Font]').click(function() { var fonty = $(this).val(); $('#regdisplay').removeClass(); if($(this).is(':checked')) { $('#regdisplay').addClass(fonty); } });});The problem i have is once you selected the border and it has been applied to #regdisplay you then select a font but it will removeClass for the border.What i was thinking was removeClass(border-????) or removeClass(font-????) but not shore how or maybe i'm going about this all wrong.so help please.P.S. Please excuse the formatting.
  9. WAIT A MIN... i dont understand arrays fully but it it right that...first array([color=#ff0000]1[/color]) { ["notifications"]=> array([color=#ff0000]2[/color]) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" }} and array([color=#ff0000]4[/color]) { ["notifications"]=> array([color=#ff0000]2[/color]) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" } ["friends"]=> array([color=#ff0000]2[/color]) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" } ["messages"]=> array([color=#ff0000]2[/color]) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" } ["search"]=> array([color=#ff0000]2[/color]) { ["pos_left"]=> string(2) "20" ["pos_top"]=> string(2) "20" }} the highlited RED numbers in the arrays is this correct??? [EDIT]--WHY color=#ff0000 INSTEAD OF RED??
  10. ok so i have tried debugging and all results work just fine untill i change 4 items then it restarts the array, So how about if i change it so onunload it saves positions off the divs?? would this be a better option?
  11. WHOOPS miss type i will correct that....How would you go about debuging this?
  12. hi guys i have a problem and here it is i am makeing a website with draggable boxs lik this $(function () { $(".draggable").draggable({ containment: '#holder', grid: [ 20, 20 ], handle:'.box-header', cursor: 'move', stop : function(event,ui) { var dragposition = ui.position; var dragboxid = $(this).attr('id'); $.ajax({ type: 'POST', dataType: 'json', url: My_Site+'/themes/mytheme-2/ajax.php', timeout: 5000, data: { task:"Moved", dragposition:dragposition, user_id:User_ID, dragboxid:dragboxid } }); } });}); as you can see when you finish moving the box it will log the position with AJAX here is the "ajax.php" file if($_POST['task'] == 'Moved'){$dragboxid = $_POST['dragboxid'];$dragposition_left = $_POST['dragposition'][left];$dragposition_top = $_POST['dragposition'][top];$uid = $_POST['user_id'];$exist = mysql_query("SELECT var1 FROM `jcow_mytheme` WHERE uid >= '$_POST[user_id]' LIMIT 1");if(mysql_num_rows($exist) == 0){ $var1[$dragboxid] = array("pos_left"=>$dragposition_left,"pos_top"=>$dragposition_top); $var1e = serialize($var1); mysql_query("INSERT INTO `".$table_prefix."mytheme` (uid, var1) VALUES('$uid', '$var1e' ) "); }else{ $row = mysql_fetch_array($exist); $var1d = unserialize($row['var1']); $var1d[$dragboxid] = array("pos_left"=>$dragposition_left,"pos_top"=>$dragposition_top); $var = serialize($var1d); mysql_query("UPDATE `".$table_prefix."mytheme` SET var1='$var' WHERE uid='$_POST[user_id]'"); }} this all works GREAT, but only once, the second time it wipes the array and starts again i will post some of the array to show my problemfirst time array(1) { ["notifications"]=> array(2) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" }} second time array(2) { ["notifications"]=> array(2) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" } ["friends"]=> array(2) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" }} Forth time array(4) { ["notifications"]=> array(2) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" } ["friends"]=> array(2) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" } ["messages"]=> array(2) { ["pos_left"]=> string(1) "0" ["pos_top"]=> string(2) "20" } ["search"]=> array(2) { ["pos_left"]=> string(2) "20" ["pos_top"]=> string(2) "20" }} and the wierd one Fifth one array(1) { ["new_member"]=> array(2) { ["pos_left"]=> string(3) "-20" ["pos_top"]=> string(2) "20" }} HELP PLEASE lolthanks guys
  13. hi guys i am having trouble with the syntax of a query here is what i have not shore where to go from here select * from `jcow_accounts` WHERE 1 AND (username LIKE craig% OR email LIKE craig% OR fullname LIKE craig%) AND birthyear>1953 AND birthyear<1995 AND gender=0 and !hide_me order by lastlogin DESC LIMIT 20 Thanks
  14. click settings to get back to form saying that it still logged your location
×
×
  • Create New...