Jump to content

dzhax

Members
  • Content Count

    363
  • Joined

  • Last visited

Everything posted by dzhax

  1. dzhax

    Finding the min value

    So I have a slider on my page. I need to determine the minimum amount via php. I know this is more a math question than a php question. I have a variable called $perCost. This variable is the cost of 1 unit. I need to determine how many units must be purchased for the total cost to equal at least $minPurchase. This value i will then set as the minimum value of the slider. Any help on this would be much appreciated.
  2. Figured it out. forgot to put the css for the backsplash when IE < 9. Thanks for everyone's help!
  3. thank you for the F12 tip. For some reason everything is working fine now. I don't know why. It wasn't a cookie/cache issue becasue I always ctrl+f5 when i refresh so it loads new each time. so weird. I did find out that my IE was set to IE10 Compatability mode and it uses RGBA just fine when it is not in comatability mode What is weird now is when I click on the image in compatability mode the image shows but the backsplash doesn't.
  4. wow i feel dumb with the image thing. as for the actual page in question, http://www.louisgarrett.me to get to the picture in question: 1. click the gray background as the under construction message states ( background is gray in IE and its dimmed in chrome, ff, etc. as IE doesn't support rgba(###,###,###,###) ) 2. click on PROJECTS in the navigation at the top of the screen 3. click on the thumbnail to the right of "Stand Them Up" the similar code i stated is what is generating the under construction message. as far as checking the console, does IE have a console? I know FF and Chrome does but i never seen an IE console.
  5. So I am building my own "click a thumbnail and it shows and enlarged version" script for my personal website. As the title says it works beautifully in chrome but it does not work in IE $(document).ready(function() { $('.projectThumbnail').click(function(){ $('<div>',{id:"thumbBacksplash"}).css('display','none').appendTo("body").fadeIn(350, "linear"); $('<div>',{id:"thumbnail"}).css('display','none').appendTo("#thumbBacksplash").html("<image class='terminate' onclick="closeImage()" src='image/terminate.png' alt='Close' title='Close Image'><image class='largeThumb' src='"+$(this).children('img').attr('src')+"' alt='"+$(this).children('img').attr('alt')+"' /><div class='normal thumbHelp'>To close the image click the X in the top left of the image or <span onclick="closeImage()">Click Here</span></div>").fadeIn(350, "linear"); });}); function closeImage(){ $('#thumbBacksplash').fadeOut(350, "linear", function() { $(this).remove(); }); $('#thumbnail').fadeOut(350, "linear", function() { $(this).remove() });} So what it does is creates 2 divs "on the fly". one is a backdrop that covers the page. The other is a div that holds the enlarged version of image. The part I am having trouble with is the $('.projectThumbnail').click() doesn't appear to fire. I am using almost i identical code for creating divs in other aspects of the site so I know that part is correct. is there a known issue with using the jquery method .click() in IE?
  6. adding the callback instead of adding it to the end did it. thanks a lot both of you!
  7. Hey everyone! I have the following code: $('#notification').fadeOut(450).remove(); when this fires it is removing the element before it's done fading. is there something I am doing wrong? Also I even tried adding .delay(x) in between the fadeOut and remove.
  8. wow why didn't i think of that. Thanks JustSomeGuy! works like a charm
  9. tried using this and that didn't work either. Basically the code that I have is when an object is clicked it creates a div with an image that starts falling from the top of the screen down to a certain point. When it reaches that point it deletes itself. I am just trying to modify it to fadeOut the div before deleting to give it a more appealing effect. Here is all the code that is relevant to making this happen and the code I have been focusing on is Line:12 BaconClicker = {};BaconClicker.Start=function(){ BaconClicker.setInterval = setInterval(function() { var drops = document.getElementsByClassName('smallBacon'), newY; if (drops.length == 0) { clearInterval(interval); return; } for (var i = 0; i < drops.length; i++) { newY = drops[i].offsetTop+3; if (newY > drops[i].parentNode.offsetHeight) { $(drops[i]).fadeOut(350, function() { this.parentNode.removeChild(drops[i]); }); } else { drops[i].style.top = newY + 'px'; } } }, 30); BaconClicker.click=function(){ //Increment bacon strips and other stuff BaconClicker.dropBacon(); } BaconClicker.dropBacon=function(){ var x = randomFromInterval(10, 200), y = -75; n = 0; strop(x, y, n, 'leftWindow'); }} function strop(cleft, ctop, d, dropWindow) { var drop = document.createElement('div'); drop.className = 'smallBacon'; drop.style.left = cleft + 'px'; drop.style.top = ctop + 'px'; drop.id = d; document.getElementById(dropWindow).appendChild(drop);} function randomFromInterval(from, to) { return Math.floor(Math.random() * (to - from + 1) + from);}
  10. Thank you for the prompt response. For some reason that is not deleting the divs though. just having the drops.parentNode.removeChild(drops); works fine but $(drops).fadeOut(350, function() {drops.parentNode.removeChild(drops);}); does not delete them. It does fade them out though. Really weird
  11. I have the following code drops[i].parentNode.removeChild(drops[i]); it is used to remove the element once it reaches a specific top value. I wanted to have that element .fadeOut(350) before removing the element. so i tried: $(drops[i]).fadeOut(350).parentNode.removeChild(drops[i]); But i'm now getting the following error in my console: Uncaught TypeError: Cannot call method 'removeChild' of undefined if more code is needed feel free to ask
  12. I have a program I am working on and I am not the best at java so I am probably not doing this correctly. I have a string that holds the name of an object I want to use (Example: txtCaller) I want to then take txtCaller and copy, cut, or paste the text that is currently selected in that object to the clipboard. Essentially im adding the cut, copy, paste on right click feature to my program. Here is some snippets of code: public class gui extends javax.swing.JFrame { public JPopupMenu popup; String rightClickedField, rightClickedValue, copiedTxt; public gui() { popup = new JPopupMenu(); ActionListener menuListener = new ActionListener() { public void actionPerformed(ActionEvent event) { if(event.getActionCommand() == "Cut"){ System.out.println("Action: Cut " + rightClickedValue + " from " + rightClickedField); } if(event.getActionCommand() == "Copy"){ System.out.println("Action: Copied " + rightClickedValue + " from " + rightClickedField); } if(event.getActionCommand() == "Paste"){ System.out.println("Action: Pasted to " + rightClickedField); } } }; JMenuItem item; popup.add(item = new JMenuItem("Cut")); item.addActionListener(menuListener); popup.add(item = new JMenuItem("Copy")); item.addActionListener(menuListener); popup.add(item = new JMenuItem("Paste")); item.addActionListener(menuListener); initComponents(); } private void txtCallerMouseClicked(java.awt.event.MouseEvent evt) { if(evt.getButton() == 3){ System.out.println("Right Click Detected - Initiating Popup Menu"); popup.show(gui.this, evt.getX() + 120, evt.getY() + 45); rightClickedField = "txtCaller"; rightClickedValue = txtCaller.getSelectedText(); } }
  13. thanks justsomeguy, that did it. as for using a string instead of an array? I am eventually going to define that extensions on the original page and send the domains and extensions to this page via an ajax connection. sending a string vs an array seemed easier.
  14. So I am working on a mass availability php script. What it does is it runs through a list of domain names the user provides and checks to see if any of them are available for registration or not by checking its who-is information. It is basically working until I print out the findings <?php$extensionList = "com-org-net-info-tv"; if(!isset($_POST['Submit'])) { echo '<form method="POST" action="' . $_SERVER['PHP_SELF'] . '">' . 'Please type each domain one per line without the extension:<br/>' . '<textarea name="domains" rows="20" cols="63"></textarea><br />' . '<input type="submit" name="Submit" value="Submit">' . '</form>';} else { $domains = explode("\n", str_replace(array("\r\n", "\r"), "\n", $_POST['domains'])); $extension = explode("-",$extensionList); echo "<table>" . "<tr id='header'>" . "<td class='head'>Domain</td>"; foreach($extension as $ext) echo "<td class='head'>" . $ext . "</td>"; echo "</tr>"; foreach($domains as $domain) { $outResult = is_avail($domain, $extensionList); $result = explode(" ", $outResult); $availCount = 0; foreach($result as $addRes) if($addRes == 1) $availCount++; echo "<tr name='"; if($availCount > 0) echo 'avail'; else echo 'not'; echo "'><td>" . $domain . "</td>"; $i = 0; foreach($result as $list) if($list == "1") echo "<td>Yes</td>"; else echo "<td>No</td>"; $i++; echo "</tr>"; } echo "</table>"; }function is_avail($domain, $extList) {$combResult = "";$extensions = explode("-", $extList);foreach($extensions as $extension){ $pieces = explode(".", $domain.".".$extension); $server = (count($pieces) == 2) ? $pieces[1] : $pieces[1] . "." . $pieces[2]; $server .= ".whois-servers.net"; $fp = fsockopen($server, 43, $errno, $errstr, 10); $result = ""; if($fp === FALSE) return FALSE; fputs($fp, $domain . "\r\n"); while(!feof($fp)) $result .= fgets($fp, 128); fclose($fp); $output = (stristr($result, 'no match for') !== FALSE) || (strtolower($result) == "notfound\n") ? "1" : "0"; $combResult .= $output . " "; } $combResult = $domain . " " . $combResult; return($combResult);}?> When it prints I am getting 2 extra responses from each Domain name. I am not sure where it is coming from. example output: Domain com org net info tvwatchtbr No No No No No Yes Nogiboard No Yes No Yes No Yes No ^^^^ not turning out how i would like it but basically the second yes and no are there with no "header" row to explain what it means. EDIT: Now that im reading this i have removed: $combResult = $domain . " " . $combResult; and now I only have 1 extra result. but still not sure how to get rid of it
  15. got it to work I didn't need a js function at all. Dove into the manifest.json documentation some more and found I can do what i was trying to do in there.
  16. I'm trying to develop a simple chrome app that will launch a specific webpage in a new tab on chrome. I ran through the tutorial on the developer.chrome.com but it makes a new standalone window it doesn't load the page in a tab.If you don't understand what I am talking about check out the code anywhere app on the google chrome app store. That's basically what I am after. It adds the button to the start page of chrome and when you click on it the page loads the code anywhere website. background.js chrome.app.runtime.onLaunched.addListener(function() { chrome.app.window.create('window.html', {});}); window.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><meta http-equiv="refresh" content="0;URL='http://www.watchtbr.com/'" /><title>WatchTBR.com</title></head> <body> </body> </html>
  17. thanks for that. I am now using for (i=0; i < elems.length; i++) { and the error is no longer showing in the console. however the div is still not expanding. Nevermind I fixed it. I added a break after calling expandMenu();
  18. Sorry man, I'm stumped on this one. Anyone else care to take a look?
  19. Hello everyone! Working on animating my page with some jquery .animate and having some trouble. I have the following script to "collapse" a menu and load new content to the <td> however I am having difficulty expanding the <td> after the new content has completed loading. <script type="text/javascript"> function loadNav(received){ if(received.parentNode.className != "selected"){ $('#header').animate({height: "-=95px"}, { duration: 350,complete: function() { var elems = document.getElementsByTagName('*'), i; for (i in elems) { if((elems[i].className).indexOf('menu')> -1) { var child_span = elems[i].getElementsByTagName("td"); for(i=0;i<child_span.length;i++){ child_span[i].className=""; } child_span[0].className ="file"; received.parentNode.className="selected"; document.getElementById('menuBody').innerHTML = "<td colspan=10><div>"+received.innerText+"</div></td>"; expandMenu(); } } } }); } } function expandMenu(){ $('#header').animate({height: "+=95px"}, 'slow'); }</script> it works just fine collapsing the div but it will not open back up. Also I get the following error in the console Uncaught TypeError: Cannot call method 'indexOf' of undefined and its pointing to this line: if((elems[i].className).indexOf('menu')> -1) { However the first half of the animation is completing and the className's are updating like normal. Any help on this is much appreciated.
  20. hmm your right... change the above mention code to this: $(window).resize(function(){ $('.keyboardscroll').css('height', document.height); $('.keyboardscroll').css('width', document.width);}); not sure why it wasn't being called properly when re-sizing but checking the window rather than the document seems to work.
  21. $(document).resize(function(){ $('.keyboardscroll').css('height', document.height); $('.keyboardscroll').css('width', document.width);}); This should be re-sizing the elements when the browser is being re-sized.You used the above code I posted right?
  22. Javascript... blah!

  23. Correct me if im wrong but shouldn't while (anyDigits !== true) { be while(anyDigits != true){
  24. EDIT:I ended up using the following code. for some reason the $.getScript was not loading the boxSlider.js all the way. Bascially the slideshow animation was not happening. So I search for adding css dynamically and modified the sample code to load a script not link a css script and it worked. Here it is: var findScriptStart = data.split('<script type="text/javascript" src="'),i;for(i in findScriptStart){ if(i != 0)var findScriptEnd = findScriptStart[i].split('"></script>'),ii; for(ii in findScriptEnd){ if(debug)console.log("Loading following JS: "+findScriptEnd[0]); var scriptURL = findScriptEnd[0]; //$.getScript(scriptURL, function(data2, textStatus, jqxhr) {}); $('<script type="text/javascript" src="'+scriptURL+'" ></script>').appendTo("head"); }}$("body").html(data); the only issue im having now is something with this code is not 100%. Its loading the scripts in the the <head> fine but its adding it twice. also I tried using the following code to remove the scripts from the data before it gets innerHTML'd to the page: data = data.replace('<script type="text/javascript" src="'+scriptURL+'" ></script>',''); but it doesn't work.
  25. yea the above "full source" was pulled from chrome after the page loaded. so the stuff thats in the body right now was loaded from /page/home.html as for the <!DOCTYPE>, <html>, <head> and <body> tags, the only thing from the home.html that is being pulled is what is in the body tag. thats why the javascript and css link is where it is. I will try removing that stuff from the page to see if it renders any better. Its just weird that leaving out main.js and the page loads just fine. EDIT: the home.html does not have any of the above tags. here is the source <link rel="stylesheet" type="text/css" href="lib/css/boxSlider.css" media="all" /> <link rel="stylesheet" type="text/css" href="lib/css/home.css" media="all" /> <script type="text/javascript" src="lib/js/home.js"></script> <div id="maincontent"> <div id="header"> <div> <img src="lib/img/logo.png" alt=""/> </div> </div> <div id="media"> <div class="transistor"> <span class="pixelSize">30</span> <span class="threshold">0.9</span> <span class="speed">0.06</span> <span class="time">2000</span> <span class="opacitySpeed">0</span> <span class="fadeTimeout">60</span> <span class="bannerOffset">0</span> <span class="bannerOpacity">1</span> <img src="lib/img/1.png" alt="Integrated tools offer WYSIWYG editing" /> <img src="lib/img/2.png" alt="Most software is complicated, not ours." /> <img src="lib/img/3.png" alt="Don't think because you know more than the average user that you can't take advantage of our software" /> </div> <div class="navigation"></div> </div> <div id="content"> <script type="text/javascript"> isAcceptingNewWork(); </script> <div> <h2>Welcome</h2> <p> GI.Board is a CMS (Content Management System) written from scratch by Garrett Innovations. We strive to make self-service content for our customers so you don't have to wait for content changes to be updated. You can simply log into your site and make changes on the fly. Making all aspects of the software as intuitive as possible will help users understand how to do something without having to learn how to code. </p> <p> Our WYSIWYG (What you see is what you get) HTML editors assist you in making professional looking websites with little to no knowledge. However, we do not limit our more experienced users by only offering these easy-to-use solutions. We still offer the more advanced, raw HTML editors aswell. </p> <h2>Other Services</h2> <p> Don't have time to build a site from scratch? We understand! This is why we offer many other services to aid you in making your website. Wether it is pre-built templates, artwork creation, or a fully-custom website. We can meet your needs! We can even host the website for you, all you would need to do is purchase a domain name from your favorite registrar and point it at our servers. </p> <h2>Trust</h2> <p> We stand behind our products 100%. In fact this website is running on GI.Board! There is nothing more that demonstrates a companies trust in their product than using it themselves as their main presence in the market. </p> </div> </div> <div id="footer"> <div class="creator"> Powered By: <img src="lib/img/giboard.png" alt="Creator Badge" title="Website Developed By Garrett Innovations" onclick="goto('http://www.garrett-innovations.com')" /> </div> <div id="copyright" class="copyright"> © 2004-2013 Garrett Innovations. All Rights Reserved. </div> <div id="isonline" class="isonline"> </div> </div> <script type="text/javascript" src="lib/js/boxSlider.js"></script>
×
×
  • Create New...