• Web Development Questions That Don't Need Their Own Thread v2
    3,079 replies, posted
[QUOTE=Alcapwne;31669996]imgur have an api which is probably much more widely used than anyhub's so they will have more support etc.[/QUOTE] The thing is I don't want to complicate my code by having to worry with OAuth, that was what I like about the anyhub API, it was simple and did exactly what it had to. I would use anyhub if only the files were accessible once you upload them. (It loads forever until the connection resets.)
[QUOTE=commander204;31670077]The thing is I don't want to complicate my code by having to worry with OAuth, that was what I like about the anyhub API, it was simple and did exactly what it had to. I would use anyhub if only the files were accessible once you upload them. (It loads forever until the connection resets.)[/QUOTE] I have no idea what that means, I just knew imgur had an API so I decided to try and contribute :v:
Hey I'm trying to change one of the div classes on my page when the website detects that the user is using Internet Explorer using Javascript, however it's not working. I haven't really used javascript before, so I've probably done something horribly wrong :D. Here is the code I have: [code] <script type= "text/javascript"> if (navigator.appName == "Microsoft Internet Explorer") { if (div.className == "hidden") { div.className = "hidden"; } else { div.className = ""; } } </script> [/code] Currently the div is called hidden, and I want it to stay as that if the user is on Internet Explorer, but any other browser I want to change the class to "" to disable it (maybe there's a better way to do that)
[QUOTE=djjkps3;31670893]Hey I'm trying to change one of the div classes on my page when the website detects that the user is using Internet Explorer using Javascript, however it's not working. I haven't really used javascript before, so I've probably done something horribly wrong :D. Here is the code I have: [code] <script type= "text/javascript"> if (navigator.appName == "Microsoft Internet Explorer") { if (div.className == "hidden") { div.className = "hidden"; } else { div.className = ""; } } </script> [/code] Currently the div is called hidden, and I want it to stay as that if the user is on Internet Explorer, but any other browser I want to change the class to "" to disable it (maybe there's a better way to do that)[/QUOTE] I'm no javascript pro but I think you have to add a document ready function the whole thing
The first if statement works, detecting Internet Explorer, however none of the rest works
[QUOTE=djjkps3;31670893]Hey I'm trying to change one of the div classes on my page when the website detects that the user is using Internet Explorer using Javascript, however it's not working. I haven't really used javascript before, so I've probably done something horribly wrong :D. Here is the code I have: [code] <script type= "text/javascript"> if (navigator.appName == "Microsoft Internet Explorer") { if (div.className == "hidden") { div.className = "hidden"; } else { div.className = ""; } } </script> [/code] Currently the div is called hidden, and I want it to stay as that if the user is on Internet Explorer, but any other browser I want to change the class to "" to disable it (maybe there's a better way to do that)[/QUOTE] If div.className has only two values, "hidden" and "", then i see the problem. you're also checking if it's set to hidden before setting it to hidden, so if it's set to hidden then it'll always be set to hidden, and if it's not it'll always be set to "". Remove the if that checks for the div's classname and it'll just set it to "" if the browser is in IE. [editline]11th August 2011[/editline] [code]<script type= "text/javascript"> if (navigator.appName == "Microsoft Internet Explorer") { div.className = ""; } </script>[/code] also make sure div is defined :v:
[QUOTE=Ac!dL3ak;31674259]If div.className has only two values, "hidden" and "", then i see the problem. you're also checking if it's set to hidden before setting it to hidden, so if it's set to hidden then it'll always be set to hidden, and if it's not it'll always be set to "". Remove the if that checks for the div's classname and it'll just set it to "" if the browser is in IE.[/QUOTE] Ah I see, thanks. I'm not quite sure how to define the div though
[QUOTE=commander204;31670077]files were accessible once you upload them. (It loads forever until the connection resets.)[/QUOTE] nginx is being a pain in the ass, i'll have to get interserver to reinstall the os i think
Can somebody help me sort out link colors? I know to use :link, :visited, :active and finally :hover, but I don't know how to apply link color to these divs I have at the moment. I have tried #footer1:link, but any colors I apply do not seem to work. Can somebody point me in the right direction? Here is my HTML (also should I use divs like this?) : [url]http://i52.tinypic.com/2aacxfp.png[/url] And this is my CSS : [url]http://i53.tinypic.com/abh1d2.png[/url] Thank you!
[QUOTE=Oppenheimer;31678804]Can somebody help me sort out link colors? I know to use :link, :visited, :active and finally :hover, but I don't know how to apply link color to these divs I have at the moment. I have tried #footer1:link, but any colors I apply do not seem to work. Can somebody point me in the right direction? Here is my HTML (also should I use divs like this?) : [url]http://i52.tinypic.com/2aacxfp.png[/url] And this is my CSS : [url]http://i53.tinypic.com/abh1d2.png[/url] Thank you![/QUOTE] I'm not quite sure what you're asking, but if you're trying to have different link styles for the different <divs>, then you could use CSS classes. For example: [code] a.footer1:link { color: #000000; font-size: 12pt; } a.footer1:hover { color: #ffffff; font-size: 12pt; } a.footer2:link { color: #000000; font-size: 13pt; } a.footer2:hover { color: #ffffff; font-size: 14pt; } etc. [/code] and the HTML: [code] <div id="footer1"> <a href="twitter.com" class="footer1">Fine me on Twitter</a> </div> <div id="footer2"> <a href="facebook.com" class="footer2">Fine me on Facebook</a> </div> [/code]
[QUOTE=Alcapwne;31678918] words [/QUOTE] Aha! Thank you! I have a new question, how would I center-align these images side by side? Is there an easy way? [url]http://i54.tinypic.com/20rjyhw.png[/url]
[QUOTE=Oppenheimer;31679111]Aha! Thank you! I have a new question, how would I center-align these images side by side? Is there an easy way? [url]http://i54.tinypic.com/20rjyhw.png[/url][/QUOTE] Put the pictures in a "text-align:center" div, and the pictures themselves as a class with the attribute "display:inline" Though you may not have to do the second part if the images are without a class.
[QUOTE=djjkps3;31670893]Hey I'm trying to change one of the div classes on my page when the website detects that the user is using Internet Explorer using Javascript, however it's not working. I haven't really used javascript before, so I've probably done something horribly wrong :D. Here is the code I have: [code] <script type= "text/javascript"> if (navigator.appName == "Microsoft Internet Explorer") { if (div.className == "hidden") { div.className = "hidden"; } else { div.className = ""; } } </script> [/code] Currently the div is called hidden, and I want it to stay as that if the user is on Internet Explorer, but any other browser I want to change the class to "" to disable it (maybe there's a better way to do that)[/QUOTE] Using conditional comments and CSS would work nicer. Edit: Although I don't see the point in doing it in the first place, IE9 (at least) is ok.
How would I automatically stretch a background image to fit the dimensions of its element?
Use background-size, current browsers implement it without a prefix, older ones require it though.
[QUOTE=TheDecryptor;31684617]Using conditional comments and CSS would work nicer. Edit: Although I don't see the point in doing it in the first place, IE9 (at least) is ok.[/QUOTE] Afaik a lot of people still use IE8 as windows xp doesn't support IE9. the box shadow and custom fonts on my website don't work in IE8 so I'm trying to work around that
If you custom font doesn't work in IE, use this: [url]http://www.fontsquirrel.com/fontface/generator[/url]
Alright, so I'm using phpbb3, and I'm trying to get a spoiler code to work right. However, I don't have a clue how to use CSS, so I asked a friend to give me the code from their forum. This is what they gave me. [code]<div class="spoilerwrapper"> <div class="spoilertitle" style="border-bottom-style: none;"> <input class="btnbbcode" value="{TEXT1}" style="margin: 0px; padding: 0px; width: 100px; font-size: 10px;" onclick=" if (this.parentNode.parentNode.getElementsByTagName('div')[1].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].style.display = ''; this.innerText = ''; this.value = '{TEXT2}'; this.parentNode.style.borderBottomStyle = 'solid'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].style.display = 'none'; this.innerText = ''; this.value='{TEXT1}'; this.parentNode.style.borderBottomStyle = 'none'; } " type="button"> </div> <div class="spoilercontent" style="display: none;">{TEXT3}</div> </div>[/code] and they said to use this for the CSS classes: [code] .spoilertitle { margin: 10px 5px 0px 5px; padding: 2px 4px; border: solid 1px #090909; color: #D0D0D0; background-color: #2E2E2E; font-size: 0.85em; font-weight: bold; } .spoilercontent { margin: 0px 5px 10px 5px; padding: 5px; border-color: #090909; border-width: 0px 1px 1px 1px; border-style: solid; font-weight: normal; font-size: 1em; line-height: 1.4em; background-color: #2E2E2E; color: #EEE; } .spoilerwrapper { clear: both; margin: 10px 5px; padding-left: 19px; border: solid 1px #090909; background-color: #a92d1d; background-image: url(images/spoiler_header.gif); background-repeat: no-repeat; background-position: left top; } .spoilerwrapper .spoilertitle { margin: 0; border-width: 0 0 1px 1px; } .spoilerwrapper .spoilercontent { margin: 0; border-width: 0 0 0 1px; }[/code] However, while it does give me a working spoiler tag, it doesn't create a box around it. Can someone tell me what I'm doing wrong here?
whoa it's tomaster, i know you how ya doin man?
Woah. TehWhale, I didn't know you did web stuff. I'm decent man, just trying to get things I don't understand to work right :suicide:
my nav controls will not ALIGN [img]http://dl.dropbox.com/u/1439918/Pics/2011-08-12_1614.png[/img] [editline]12th August 2011[/editline] [code]#header { background-color:#000; color:#FFF; width:100%; height:60px; } #logo { text-transform:uppercase; font-family:"Impact", sans-serif; font-size:18pt; margin-left:50px; } #nav { font-family:"Tahoma", sans-serif; font-size:11pt; padding-left:75px; } #nav ol { display:inline; } #nav li { display:inline; padding-right:10px; } #nav li a { color:#FFF; text-decoration:none; } #nav li:last-child { padding-right:0; } .center { line-height:60px; vertical-align:center; }[/code] [code]<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="description" content="der thread~"> <link rel="stylesheet" href="css/reset.css"> <link rel="stylesheet" href="css/style.css"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script> <title>der thread~</title> </head> <body> <div id="header"> <span id="logo" class="center">der thread</span> <span id="nav"> <ol> <li><a href="#">Settings</a></li> <li><a href="#">Self</a></li> <li><a href="#">Messages</a></li> <li><a href="#">New</a></li> </ol> </span> </div> </body> </html>[/code]
[QUOTE=Tomaster;31693852]Alright, so I'm using phpbb3, and I'm trying to get a spoiler code to work right. However, I don't have a clue how to use CSS, so I asked a friend to give me the code from their forum. This is what they gave me. However, while it does give me a working spoiler tag, it doesn't create a box around it. Can someone tell me what I'm doing wrong here?[/QUOTE] By box do you mean background? Like Facepunch's? [editline]12th August 2011[/editline] [QUOTE=TehWhale;31694963]my nav controls will not ALIGN [img]http://dl.dropbox.com/u/1439918/Pics/2011-08-12_1614.png[/img] [editline]12th August 2011[/editline] [/QUOTE] Align which way? Vertical align with the title?
The Der Thread is vertically aligned, but the nav isn't. The highlight (blue) was just showing that they weren't aligned
[QUOTE=TehWhale;31698119]The Der Thread is vertically aligned, but the nav isn't. The highlight (blue) was just showing that they weren't aligned[/QUOTE] [code] #header { background-color:#000; color:#FFF; height:60px; } h1 { text-transform:uppercase; font-family:"Impact", sans-serif; font-size:18pt; margin:15.5px 0 15.5px 50px; float:left} #nav { font-family:"Tahoma", sans-serif; font-size:11pt; padding-left:75px; float:left;margin:21px 0; } #nav li { display:inline; padding-right:10px; } #nav li a { color:#FFF; text-decoration:none; } #nav li:last-child { padding-right:0; } .clear {clear:both}[/code] [code] <div id="header"> <h1 id="logo" class="center">der thread</h1> <ol id="nav"> <li><a href="#">Settings</a></li> <li><a href="#">Self</a></li> <li><a href="#">Messages</a></li> <li><a href="#">New</a></li> </ol> <br class="clear" /> </div> [/code] Why don't you use div's and h1's instead of spans?
CAUSE I'M A TERRIBLE DESIGNER I don't know, and you're a god damn bro [editline]12th August 2011[/editline] Thanks [editline]12th August 2011[/editline] oh i see what you did thar [editline]12th August 2011[/editline] you just padded it correctly and stuff instead of using vertical-align, and you can use half a pixel?
[QUOTE=TehWhale;31698713]CAUSE I'M A TERRIBLE DESIGNER I don't know, and you're a god damn bro [editline]12th August 2011[/editline] Thanks [editline]12th August 2011[/editline] oh i see what you did thar [editline]12th August 2011[/editline] you just padded it correctly and stuff instead of using vertical-align, and you can use half a pixel?[/QUOTE] That was a mistake, I just calculated precisely and forgot to take it out.
So I'm interested in learning PHP, and I was told by a friend that [URL="http://www.tizag.com/"]Tizag[/URL] is a good site to use. Can anyone else recommend them, or give other places to look into as well?
Nevermind. The problem has resolved itself without me doing anything, apparently.
[QUOTE=Anti Christ;31699866]So I'm interested in learning PHP, and I was told by a friend that [URL="http://www.tizag.com/"]Tizag[/URL] is a good site to use. Can anyone else recommend them, or give other places to look into as well?[/QUOTE] Tizag and php.net are good sites.
[QUOTE=commander204;31670077]The thing is I don't want to complicate my code by having to worry with OAuth, that was what I like about the anyhub API, it was simple and did exactly what it had to. I would use anyhub if only the files were accessible once you upload them. (It loads forever until the connection resets.)[/QUOTE] The OS has been reinstalled and the server should be running fine now, there should not be any other issues, but if there are, send a tweet to @anyhub and if I see it I'll try restarting nginx for you.
Sorry, you need to Log In to post a reply to this thread.