• Questions That Don't Need Their Own Thread v3
    4,068 replies, posted
  • My bank doesn't even use passwords. I have to use this little device which I put my debit card in and then type my PIN in. It will then give me a code I have to enter to log in. My other bank which is online uses a PIN like code which is 6 numbers in length and then a rememberable date.
  • Is it wrong what I'm doing here? [code] <a onclick="changecontent(1)" href="#1">menu1</a> <a onclick="changecontent(2)" href="#2">menu2</a> <a onclick="changecontent(3)" href="#3">menu3</a> <a onclick="changecontent(4)" href="#4">menu4</a> <div class="content" id="content1">one</div> <div class="content" id="content2">two</div> <div class="content" id="content3">three</div> <div class="content" id="content4">four</div> [/code] [code] changecontent(window.location.hash.substr(1,window.location.hash.length-1)); function changecontent(show){ var showmenu = "#content"+show; $(".content").fadeOut(350).delay(350); $('html, body').animate({ scrollTop: 0 }, 'fast'); $(showmenu).fadeIn(350); } [/code] [code] .content{display:none;} #content1{display:block;} [/code]
  • But the way I'm showing content isn't wrong? Everything is in one file now and shows/hides using js when depending on what link the users clicks. If someone disabled js they won't get too far. Is this wrong to use this?
  • Well if you have addons like NoScript, which a lot of users do it's not ideal. But it's entirely down to you.
  • You can use the hashchange event to listen for changes: [code] // check for hash changes $(window).bind('hashchange', function(){ // capture current location var url = document.location, path = url.pathname.substr(1), // remove trailing slash to prevent GA dupes hash = url.hash.substr(2).replace(/\/$/, ''), masterPath = path || hash, // split masterpath by slashes pathSegments = masterPath.split('/'), // grab the first segment as page page = pathSegments[0]; loadPage(page, // call page specific functions function(){ switch( page ) { default: case '': loadSlider(); break; case 'contactus': stuff(); break; } // hash all links in the body hashLinks(body); } ); }) .trigger('hashchange'); [/code] You can also use javascript to convert links to hash links so if JS is disabled standard links are shown.
  • [QUOTE=jaybuz;35709550] You can also use javascript to convert links to hash links so if JS is disabled standard links are shown.[/QUOTE] But that would still require me to put every piece of content in a different file.
  • [QUOTE=Miljaker;35710063]But that would still require me to put every piece of content in a different file.[/QUOTE] well, just hide the content then and display it all if JS is disabled then you can forget about the links.
  • [QUOTE=Slater;35705627]Here's a funny one for you. I rent my domain name from 123-reg.co.uk, and they've recently adopted a new password validation system. ALL passwords now HAVE to be EXACTLY 8 characters long. Why? At first thought I'd have thought it was to save on database size, but surely that'd be 8 or less characters. Thoughts?[/QUOTE] Maybe they just have a really crappy password system that can't possibly have anything but 8 characters.
  • What's a good way of validating 1 person without a password? So like there can be 1 moderator who doesn't need to login.
  • [QUOTE=toaster468;35725840]What's a good way of validating 1 person without a password? So like there can be 1 moderator who doesn't need to login.[/QUOTE] what do you mean? so by IPs? but that's not secure at all. Anyone can get on the computer with same ip and do shit. You can do cookies. or even make a universal password but i guess not because you said the person isn't logged in. Anyways why don't you login?
  • [QUOTE=jung3o;35725898]what do you mean? so by IPs? but that's not secure at all. Anyone can get on the computer with same ip and do shit. You can do cookies. or even make a universal password but i guess not because you said the person isn't logged in. Anyways why don't you login?[/QUOTE] I thought it would be easier for the moderator. I guess I'll have to make accounts then.
  • [QUOTE=Miljaker;35709053]Is it wrong what I'm doing here? [code] <a onclick="changecontent(1)" href="#1">menu1</a> <a onclick="changecontent(2)" href="#2">menu2</a> <a onclick="changecontent(3)" href="#3">menu3</a> <a onclick="changecontent(4)" href="#4">menu4</a> <div class="content" id="content1">one</div> <div class="content" id="content2">two</div> <div class="content" id="content3">three</div> <div class="content" id="content4">four</div> [/code] [code] changecontent(window.location.hash.substr(1,window.location.hash.length-1)); function changecontent(show){ var showmenu = "#content"+show; $(".content").fadeOut(350).delay(350); $('html, body').animate({ scrollTop: 0 }, 'fast'); $(showmenu).fadeIn(350); } [/code] [code] .content{display:none;} #content1{display:block;} [/code][/QUOTE] Instead of using a click handler on every element, you could simply attach the handler to an element higher in the DOM and work out what do based on what element received the click. Attaching the click handler though JS is nicer as well (Through addEventListener, "on*" method are the old pre-standard way of doing things), that way you don't have to edit the HTML if your function name/options change and there's less markup transmitted to the user.
  • Learning to use jQuery, and starting simple with the Nivo Slider. The pesky git won't center, despite me assigning its wrapper the following CSS statements: [CODE] width:960px; margin:0 auto; [/CODE] Bloody annoying!
  • I am creating an edit details form and I want it to be populated with the person who's logged in details. The form has edit boxes and i'm not sure how to fill them with the details? Would I store the details in SESSION when they first log in? e.g. [CODE] $_SESSION['forename'] = $row['fName']; $_SESSION['surname'] = $row['lName']; $_SESSION['email'] = $row['email']; [/CODE] But if I do that what would I call to populate the boxes? I tried value="$_SESSION['forename']" but it gives and undefined index error.
  • I'd use Javascript and use the innerText or innerHTML function. I can't remember the syntax of the top of my head, though. [SUP]Edit: [/SUP] You could try something along the lines of: document.getElementById("FORM_BOX_ID").innerHTML = YOUR $SESSION VARIABLE It's a stab in the dark but it's worth a try, no?
  • [QUOTE=Slater;35757114]I'd use Javascript and use the innerText or innerHTML function. I can't remember the syntax of the top of my head, though. [SUP]Edit: [/SUP] You could try something along the lines of: document.getElementById("FORM_BOX_ID").innerHTML = YOUR $SESSION VARIABLE It's a stab in the dark but it's worth a try, no?[/QUOTE] Worth a try i'll have a look, cheers.
  • There's people here who're far more helpful than I am but I can still try. Let me know if you run into a problem.
  • [QUOTE=Gibo990;35757044]I am creating an edit details form and I want it to be populated with the person who's logged in details. The form has edit boxes and i'm not sure how to fill them with the details? Would I store the details in SESSION when they first log in? e.g. [CODE] $_SESSION['forename'] = $row['fName']; $_SESSION['surname'] = $row['lName']; $_SESSION['email'] = $row['email']; [/CODE] But if I do that what would I call to populate the boxes? I tried value="$_SESSION['forename']" but it gives and undefined index error.[/QUOTE] You need to check if it exists first.. [php] <input type="text" value="<?= isset($_SESSION['forename']) ? $_SESSION['forename'] : '' ?>" /> [/php]
  • [QUOTE=jaybuz;35757259]You need to check if it exists first.. [php] <input type="text" value="<?= isset($_SESSION['forename']) ? $_SESSION['forename'] : '' ?>" /> [/php][/QUOTE] That worked, thanks a lot!
  • I'm new to craftyJS and I am wondering why the [URL="http://craftyjs.com/api/Twoway.html"]twoway[/URL] (event?) isn't working. [URL]http://www.toaster468.com/[/URL] I've noticed that when gravity is on, I cannot move, but when gravity is off I can move just fine. Any ideas? EDIT: I found out it was a glitch on version 0.4.7 that gravity breaks other twoway, I am using 0.4.5 and it seems to be working great.
  • How to change display style of a class using javascript? document.getElementById("someid").style.display = 'none'; But then with class instead of id. [editline]1st May 2012[/editline] nevermind, figured it out. [code] var amount = document.getElementsByClassName("someclass").length; for(i=0;i < amount; i++){ document.getElementsByClassName("someclass").item(i).style.display = 'none'; } [/code]
  • Do I need complex scripts and stuff if I want pictures to expand when clicked?
  • [QUOTE=Clio;35783099]Do I need complex scripts and stuff if I want pictures to expand when clicked?[/QUOTE] Something like this? [URL="http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm"]http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm[/URL]
  • [QUOTE=rookwood101;35783799]Something like this? [URL="http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm"]http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm[/URL][/QUOTE] Ew, dynamic drive. Check out [url=http://lightbox-jquery.com/]Lightbox jQuery[/url], [url=http://dev.herr-schuessler.de/jquery/popeye/demo.html]jQuery.popeye[/url], [url=http://fancyapps.com/fancybox/]Fancybox[/url], [url=http://static.railstips.org/orderedlist/demos/fancy-zoom-jquery/]Fancy Zoom[/url] or [url=http://www.shadowbox-js.com/index.html]Shadowbox[/url].
  • I tried to make a wordpress website into a static html :pwn: (Using Nivo Slider) When I view it in my computer it works perfectly! [img]http://i48.tinypic.com/33cs01h.png[/img] But when I upload it to the webhost it's like this: [img]http://i47.tinypic.com/346q9g5.png[/img] (It stacks) I've tried multiple hosts. How can I fix it?
  • [QUOTE=Coffeee;35784369]I tried to make a wordpress website into a static html :pwn: (Using Nivo Slider) When I view it in my computer it works perfectly! [img]http://i48.tinypic.com/33cs01h.png[/img] But when I upload it to the webhost it's like this: [img]http://i47.tinypic.com/346q9g5.png[/img] (It stacks) I've tried multiple hosts. How can I fix it?[/QUOTE] Looks like the stylesheet isn't loading, are you sure the file path is correct? I had the same issue a while back
  • The following page contains 3 buttons which should change the background colour when clicked. [HTML]<!DOCTYPE html> <html lang="en-us"> <head> <meta charset="utf-8"> <title>Changing CSS Using JavaScript</title> <style type="text/css"> body { background-color:#FFF; padding:10px; color:#000; font-family:Verdana, Geneva, sans-serif; } #wrapper { background-color:#000; width:100%; height:auto; float:left; border-radius:15px; } .red_wrapper { background-color: #333333; } h1 { color:#FFF; background-color:#000; border-radius:10px; padding:1%; } h2 { color:#FFF; background-color:#000; border-radius:10px; padding:5px; } #content { width:55%; padding:10px; background-color:#FFF; margin:1%; border-radius:10px; float:left; } .box { background-color:#FFF; margin:1%; padding:10px; float:left; width:35%; border-radius:15px; } #bRed { background-color:#F00; } #bGreen { background-color:#0F0; } #bBlue { background-color:#00F; } </style> </head> <body> <div id="wrapper"> <div id="content"> <h1>Test</h1> <h2>Personal Profile</h2> <p>Test Test Test...</p> </div> <div class="box"> <h2>Contact Details</h2> </div> <div class="box"> <h2>Pick a color</h2> <button id="bRed">Red</button> <button id="bGreen">Green</button> <button id="bBlue">Blue</button> <script> var bRed = document.getElementById("bRed"); var bGreen = document.getElementById("bGreen"); var bBlue = document.getElementById("bBlue"); var wrapper = document.getElementById("wrapper"); bRed.addEventListener('click', bRedClick, false); bGreen.addEventListener('click', bGreenClick, false); bBlue.addEventListener('click', bBlueClick, false); function bRedClick(){ wrapper.className="red_wrapper"; } </script> </div> </div> </body> </html> [/HTML] Now, why doesn't it work ? I've been going at this all day and could really use someone else's insight.