Jump to content

RIRedinPA

Members
  • Posts

    256
  • Joined

  • Last visited

    Never

Everything posted by RIRedinPA

  1. Figured it out, change the alert to - alert($(this).css('height'));, if you're just looking for the numbers you'll have to split the "px" off the end.
  2. I got it working to an extent: This will loop through all the child elements (<p>), (kind of obvious once I thought it through) but when I try to return the height I get a funky message... <script language="javascript"> function init() { $(document).ready(function(){ $('.tablerow').each(function(index) { var maxheight = 0; $(this).children().each (function() { alert($(this).height); }) }); }); } window.onload = init; </script> and the funky message is: function (f) { var e = this[0]; if (!e) { return f == null ? null : this; } if (c.isFunction(f)) { return this.each(function (j) {var i = c(this);i[d](f.call(this, j, i[d]()));}); } return "scrollTo" in e && e.document ? e.document.compatMode === "CSS1Compat" && e.document.documentElement["client" + b] || e.document.body["client" + b] : e.nodeType === 9 ? Math.max(e.documentElement["client" + b], e.body["scroll" + b], e.documentElement["scroll" + b], e.body["offset" + b], e.documentElement["offset" + b]) : f === w ? c.css(e, d) : this.css(d, typeof f === "string" ? f : f + "px"); }
  3. If you have this html <div id="tablebox"> <ul> <li> <p>Field 1</p> <p>Field 2</p> <p>Field 3</p> <p>Field 4</p> <p>Field 5</p> <p>Field 6</p> <p>Field 7</p> <p>Field 8</p> <p>Field 9</p> <p>Field 10</p> </li> <ul> <ul> <li class="tablerow"> <p>Field 1</p> <p>Field 2</p> <p>Field 3</p> <p>Field 4</p> <p>This is a lot of text that should throw the layout off</p> <p>Field 6</p> <p>Field 7</p> <p>Field 8</p> <p>Field 9</p> <p>This is a shorter amount of text</p> </li> </ul> </div> how would I go about with jquery looping through each child of each <li> which met the argument class=tablerow? i can get here but then stumble going through the children: function init() { $(document).ready(function(){ $('.tablerow').each(function(index) { var maxheight = 0; var childcount = $(this).children.length; //this gives me the proper number of children, I now need to access the height of each one }); }); } window.onload = init;
  4. I'm trying to update an address book type database and what I want to do is add a record if the name field does not contain the name I am adding... something like this: INSERT INTO addressBook (id, name, title, phone, email) VALUES ('', 'skippy jones', 'redundant repeater', '555-555-1212', 'sjones@justanothercorporategiant.com') WHERE NOT EXISTS (SELECT * FROM addressBook WHERE name = 'skippy jones') I get errors with this...
  5. Solved it. The problem was programmer with his head up his butt. I never over wrote the original updatestatus.php file... duh...
  6. I'm trying to do something seemingly pretty simple - take a user selection from a select element and save it to a database...the select element gets written dynamically, like this: ... $resultcode .= "</p><p class=\"livedate " . $bgcolor . "\">" . $duedate . "</p><p class=\"status\"><select class=\"changestatus\" name=\"status\" id=\"" . $id . "_ status\">"; for($y=0; $y<count($statuslist); $y++) { if ($status === $statuslist[$y]) { $resultcode .= "<option value=\"" . strtolower($statuslist[$y]) . "\" selected>" . $statuslist[$y] . "</option>"; } else { $resultcode .= "<option value=\"" . strtolower($statuslist[$y]) . "\">" . $statuslist[$y] . "</option>"; } } $resultcode .= "</select> ... I then use javascript running jquery to get the item id, save that to a session, get the value selected and using AJAX send it to a php page to upload to a db... Javascript: //change status $('.changestatus').live('change', function() { //get and store id var thisid = getid(this); //get status value var thisstatus = $('.changestatus').val(); //change active back to a checkbox $.ajax({ type: "POST", url: "lib/updatestatus.php", data: "thisstatus=" + thisstatus, success: function(data) { $('#mainbox').html(data); resizerows('tablerow'); } }); }); ... function getid(thisitem) { //get id # from id attr and store in session var thisidstr = thisitem.id.split("_"); var thisid = thisidstr[0]; $.ajax({ type: "POST", url: "lib/storeid.php", data: "theid=" + thisid, success: function(data){ //alert(data); } }); return thisid; } problem is I keep getting this error message: Query was empty Your request couldn't be procesed. Even if I strip the updatestatus.php page down to just this <?php session_start() ?> I get the same error message. I can't find where it's failing. Any one have an idea?
  7. I am an ass...pointing to an older jq version...thanks for the help...
  8. I'm building a page through ajax and trying to assign a jquey click event to objects on the page... something like this: ... $code .= "<p class=\"itemname\"><a href=\"javascript:void(0);\" class=\"sort\">Item</a></p>"; ... js //sort $('.sort').live('click', function() { //ajax stuff }); but I keep getting $('.sort').live is not a function error...where am I tripping up on this?
  9. You need to clean this up somewhat (if I understand what you're looking to do: HTML: first number: <input type="text" value"" id="firstnum" /> second number: <input type="text" value"" id="secondnum" /> <input type="button" name="btnSubmit" onClick="addvalues();" /> Javascript: <script language="javascript"> function addvalues() { var firstnum = document.getElementById('firstnum').value; var secondnum = document.getElementById('secondnum').value; var total = firstnum + secondnum; alert(total); } </script> Something like that, I haven't tested it, though I would wrap the inputs in a form and use name= instead of id= and then get the values by document.formname.elementname.value
  10. nice catch and as I go to test it...the server crashes...have to wait till 9 when the help desk guys get here...
  11. Yes, showThis comes back as "fileinfo_1" and so, in theory, when concactenated as "#" + showThis should be read as "#fileinfo_1" and point to the correct <p> which is hidden...right? Could it be because I have a class and id in the target <p> that is causing the error? (I actually don't think so but am frustrated at this point and just throwing crap against a wall to see if anything sticks) : D
  12. I'm trying to just toggle a couple of objects between hide and show based on their current state but I keep running into the same error message, whether I try $(item).css('display') or $(item).is(':hidden'), I keep getting the (item).x is not a function... (where item is a variable, not a string), however I get the same error message when I hard code a string in there. Here's the relevant jquery code //...code above... $('.clickme').click(function() { //make an array of class names var myClasses = this.className.split(" "); //get last class name var showThis = "#" + myClasses[myClasses.length-1]; //toggle if ((showThis).is(':hidden')) { $(showThis).slideDown(); } else { $(showThis).slideUp(); } }); relevant html stuff <div id="resultsbox"> <ul> <li class="tablerow_1"> <p class="designator shop"> </p> <p class="itemname clickme fileinfo_1" onmouseover="cursorIn();" onmouseout="cursorOut();">GI_Item0003</p> <p class="priority"> <?php for ($s=0; $s<3; $s++) { print "<img src=\"images/star.png\" width=\"10\">"; } ?> </p> <p class="beauty"><img src="images/checkmark.png"></p> <p class="product"><img src="images/checkmark.png"></p> <p class="active"><input type="checkbox" name="id_active"></p> <p class="complete"><input type="checkbox" name="id_complete"></p> <p class="artpending"><img src="images/checkmark.png"></p> <p class="description">Words words words words words</p> <p class="swatch">No</p> <p class="livedate">06/01/2010</p> <p class="status"> <select name="status"> <option value="production">Production</option> <option value="admin">In Admin</option> <option value="live">Live</option> <option value="hold">On Hold</option> </select> </p> <p class="designer">Amy</p> </li> <li> <p class="hideme" id="fileinfo_1">This is where the file path will go</p> </li> The code will return fileinfo_1 for the class to show, but it goes no further than that. I'm assuming jquery is not recognizing the object but why? Thanks
  13. Preston...I did have it wrapped in script tags, my bad for not including it in the submitted code...anyways, here is what I finally did...kind of a blunt instrument and narrowly defined for my use but someone might get something out of it...would love to see any modifications to make it better... what I am doing is displaying a production schedule for an online store...this allows production designers and others associated with the store to see who is doing what and when, the schedule, as most things with too many cooks, is a page real estate pig, takes up a full screen, even after I chopped it up a lot with abbreviations for titles and what not. And of course those who have to use it on a daily basis whine about having to, gasp, scroll to see all the info or input their own... Such is the life of a programmer. Anyway, to make all parties happy I took non critical info and placed it in a hidden row beneath the item's critical info...to access it the user clicks on the item name (first field) and then the hidden data is revealed. Now to work on a nice slide for that data... function functionCheck(e) { //get which element was checked var targ; if (!e) { var e=window.event; } if (e.target) { targ=e.target; } else if (e.srcElement) { targ=e.srcElement; } // defeat Safari bug if (targ.nodeType===3) { targ = targ.parentNode; } if (targ.tagName === "P") { //get parent element var myParentClasses = targ.parentNode.className; //loop through all the parent classes var myParentClassesArray = myParentClasses.split(" "); for(var c=0; c<myParentClassesArray.length; c++) { if (myParentClassesArray[c].indexOf('tablerow') != -1) { myParentClass = myParentClassesArray[c]; } } var classNameArray = myParentClass.split("_"); var thisid = classNameArray[1]; var obj = 'fileinfo_' + thisid; //toggle if (document.getElementById(obj).style.display === "none") { document.getElementById(obj).style.display = "block"; } else { document.getElementById(obj).style.display = "none"; } } }
  14. I'm taking some time to learn stuff and am trying to figure out how jquery can recognize a click event without a handler... So in jquery you can do something like this $('.clickme').click(Function() { //do stuff }); <p class="clickme">By clicking on this you somehow trigger the jquery click function</p> So I figure they are tracking window events through the DOM (document.click). I've started with this bit of code, which I found through The Google. document.onclick = getEl(); function getEl() { alert(window.event); } but the alert fires off when the page loads with an undefined message. Any ideas how to accomplish this?
  15. Is there a way to make an array of all elements on a page? I tried this //hide initial elements var bodytag = document.getElementsByTagName("body"); var bodyelements = bodytag[0].children for (var e=0; e<bodyelements.length; e++) { alert(bodyelements[e].tagName); } but this only returns the top child element of body (in this case a div). I'm thinking I'll need to use some recursive check to see if the element returned has any children and push them into an array until I have them all...
  16. I'm putzing around trying to make myself smarter (it's a big hill to climb) and writing some js code to see what happens... I wrote this and got the WrappedNative prototype object execption error so I'm trying to debug but I'm not sure what this error message is telling me...the Google is no help, lot's of examples of other folks about as smart as me but couldn't find an explanation of the generic error... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Javascript Stuff</title> <!--CSS Link--> <script language="javascript"> var parentObject = { one: function () { document.write("This is function 1"); }, two: function() { document.write("This is function 2"); } }; function init() { document.write(parentObject.one() + parentObject.two()); } window.onload = init; </script> </head> <body> </body> </html> The whole error message: Error: uncaught exception: [Exception... "Illegal operation on WrappedNative prototype object" nsresult: "0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO)" location: "JS frame :: http://macdev2.merion.com/area51/javascript/ :: init :: line 22" data: no] I should note it does what I wanted it to, the output from the code is: This is function 1This is function 2
  17. I'm trying to lay out a grid/table using ul/li/p tags and am running into a problem when one of the cells has a lot of content in it, it's height will obviously be taller than the adjacent ones... is there a means through CSS where I can get all the <p> tags to be the same height as the one with the most content or do I have to do some Javascript ju jitsu? Here's an example of it not working... <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Line Height Test</title> <!--CSS Link--> <style> #tablebox { height: 400px; border: 1px solid black; } #tablebox ul { list-style-type: none; } #tablebox li { } #tablebox p { background-color: #eee; border: 1px solid blue; float: left; padding: 5px; } #tablebox p.content { width: 100px; } </style> </head> <body> <div id="tablebox"> <ul> <li> <p>Item 1</p> <p>Item 2</p> <p class="content">This is a lot of text that will wrap and needs to force the other cells to be this height.</p> <p>Item 3</p> </li> </ul> </div> </body> </html>
  18. I got a response from another forum. Just an FYI for those interested that is what is happening. Since I am loading objects after the initial load jquery is not seeing them. A poster on the other site told me to use the .live() call. http://api.jquery.com/live/ I worked around it by just calling another function with a onmousedown(); handler and then dropping the jquery scripts in there. Probably not the correct way to do it but I'm going to punt on this for now since I need to get this project wrapped up.
  19. if I am loading content into a div using the get feature of jquery, and that content has some clickable objects in it will jquery recognize those as well? What I am doing is building a site that tracks bugs on our software. The site pulls the bugs from a mysql db and displays in a table format. There's an edit link which passes the record id number of that bug (via ajax) to a php file, where a form is filled in with the bug data and passed back, a hidden div is then shown with the form in it. Part of the code I pass back has a submit button and a close button (css styled anchors) and I'm using the same process on them as I am on the edit link but not getting any results. My script looks like this: <script src="js/jquery.js"></script> <script language="javascript"> $(document).ready(function(){ //hide edit form $('#editform').hide(); //toggle bug description $("a.clickable").click(function(){ if ($('#' + $(this).attr('opendesc') + '_bottom').is(':visible')) { //alert($(this).attr('opendesc')); $('#' + $(this).attr('opendesc') + '_bottom').hide('slow'); } else { $('#' + $(this).attr('opendesc') + '_bottom').show('slow'); } }); //close bug description $("a.btnClose").click(function(){ //alert($(this).attr('closedesc')); $('#' + $(this).attr('closedesc')).hide('slow'); }); //close edit window -- not working $("a.btnCloseEdit").click(function(){ alert("you are here!"); $('#editform').hide(); }); //use ajax to load edit bug form $("a.edit").click(function(){ //get item id var itemid = $(this).attr('itemid'); //load edit form data $.get('lib/editform.php', {thisid: itemid}, function(data) { $('#editform').html(data); //alert('Load was performed.'); }); //show edit form $('#editform').show('show'); }); $("a.btnCloseEdit").click(function() { alert("k"); }); }); </script> the last click function, where I'm just posting an alert, binds back to this code, which is on the page being loaded in the ajax call: //other code <a href=\"javascript:void(0);\" class=\"submitform\">Submit</a></form><p><a href=\"javascript:void(0);\" class=\"btnCloseEdit\">X</a> //other code I'm a noob with jquery and not sure how it works. Does it sneak peek the page after it loads and get all the objects into some sort of array? I'm thinking it is doing that and because I am adding other object through AJAX it is not seeing those, since the page is not being reloaded. Am I missing something here? Thanks
  20. Yeah, but you can still toggle between 100-500 for "regular" font weight and 600-900 for "bold". It is ridiculous that at this point this issue hasn't been addressed. I read yesterday that webkit had fixed this in '06 but a test on Safari yesterday proved different.
  21. Someone in our web group was sending out an email today saying not to use font-weight: 200 as this is not picked up by any browsers. Specifically: font-weight: 200, generally nothing is picked up except for font-weigh: 800 and font-weight: bold. Any one care to comment on that?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.