Jump to content

Emwat Oon

Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by Emwat Oon

  1. I realized what the problem was, but at the same time, I don't know what else to do. I tacked on a trim() and lo and behold, it works... Cookies are also separated by spaces... I only figured it out when my specifiedDoor returned null today. Derp, of course it's going to return null, it doesn't exist anymore.
  2. So I've tried a bunch of things... If this helps anyone, the new variable specifiedDoor works like I want it to. I've also tried changing the name of the name variable to thatdoor variable, but I haven't seen anything new. window.onload = function rememberOpenDoors() { var allcookies = document.cookie; var cookiearray = allcookies.split(';'); // Get all the cookies pairs in an array // Now take key value pair out of this array for (var i = 0; i < cookiearray.length; i++) { var name = cookiearray[i].split('=')[0].toString(); var value = cookiearray[i].split('=')[1]; var thisdoor = document.getElementById(name); var specifiedDoor = document.getElementById('div104027331'); specifiedDoor.className = 'divDoorOpen'; //thisdoor.className = 'divDoorOpen'; //alert(name + " " + thisdoor); //alert("Key is : " + name + " and Value is : " + value); //console.log(name); //console.log(thisdoor); //console.log("name: " + name + " | thisdoor:" + thisdoor.id + " | thisdoor:" + document.getElementById(name) + " | value: " + value); console.log("specifiedDoor: " + specifiedDoor.id); } I found out about the .id thing when specifiedDoor returned an html document. I tried a lot of things with the .id, but no avail on the whole cookie thing.
  3. Is there a way to tie a radiobutton into a function? Like onClick? I've looked on msdn, but the closest I found is OnCheckedChanged and that isn't working for me. This is what I've tried. <asp:RadioButton ID="radSpecifyOther" runat="server" GroupName="specify" Text="Other" OnCheckedChanged="radEnableOther" EnableViewState="true"/> protected void radEnableOther(object sender, EventArgs e) { if (radSpecifyOther.Checked) txtEnableSpecify.Enabled = true; else txtEnableSpecify.Enabled = false; }
  4. I've tried a jsfiddle, but I don't think I'm doing it right. http://jsfiddle.net/n3YkU/2/
  5. Right... Assuming is always a bad mindset when debugging....... console.log("name " + name + " | thisdoor:" + thisdoor + " | thisdoor:" + document.getElementById(name) + " | value: " + value); name div103030054 | thisdoor:null | thisdoor:null | value: name div117006704 | thisdoor:null | thisdoor:null | value: That should trace to this markup. <tr class="NotinboundTbl"><td style="padding:0;" colspan="8"><div id="div117006704" class="divDoorClosed" style="position: relative; left: 5%; overflow: auto"> So I'm certain the id is there...
  6. a) The markup is <tr class="NotinboundTbl"><td style="padding:0;" colspan="8"><div id="div103030041" class="divDoorClosed" style="position: relative; left: 5%; overflow: auto"></div> c) I was thinking the code I was posting let me do just that. It's typically alert(div123 null)... But I also have firebug enabled and I do see the cookies in there. They are div123 and set on true. The true/false thing though doesn't really matter in my case. All I'm trying to do is assign the cookie to div123, find cookie div123, change said div123 css class to divDoorOpen.
  7. Hmm.. I might be doing this wrong, but I still have the same results. <body onload="rememberOpenDoors()"><script> function rememberOpenDoors() { var allcookies = document.cookie; cookiearray = allcookies.split(';'); // Get all the cookies pairs in an array // Now take key value pair out of this array for (var i = 0; i < cookiearray.length; i++) { name = cookiearray[i].split('=')[0]; value = cookiearray[i].split('=')[1]; var thisdoor = document.getElementById(name); //thisdoor.className = 'divDoorOpen'; alert(name + "" + thisdoor); //alert("Key is : " + name + " and Value is : " + value); } }</script> a) The divs are dynamically created in ASP.net's gridview, which communicates with the database See above c) The only values I'm using at the moment is true/false. In my case, I only need to use the name of the cookie.
  8. Huh... I must've forgotten to do that. I'll let you know on Monday if that fixed it.
  9. I have a var thisdoor that's returning null. It's supposed to be the cookie name div123. var allcookies = document.cookie; cookiearray = allcookies.split(';'); // Get all the cookies pairs in an array // Now take key value pair out of this array for(var i=0; i<cookiearray.length; i++){ name = cookiearray[i].split('=')[0]; value = cookiearray[i].split('=')[1]; var thisdoor = document.getElementById(name); //thisdoor.className = 'divDoorOpen'; alert(name + "" + thisdoor); //alert("Key is : " + name + " and Value is : " + value); } Can someone tell me why is variable returning null? I have the div id named div123.
  10. Duly noted. Not prepared for the frustration that comes with it though.I structured the code mentioned previously and made it look cleaner. for(var i = 0; { var convertValuetoTime = document.getElementById("GridView1").getElementsByTagName("td")[i].innerHTML; if (typeof convertValuetoTime !== 'undefined') { alert(convertValuetoTime); } else { break; } i += 9; }I still get the TypeError: document.getElementById(...).getElementsByTagName(...) is undefined.
  11. I need the javascript to convert all the numbers in a gridview column to a human readable day and time.I wanted to make progress, so I went ahead with making a javascript function to go through the column, but it turns out I need help with it... for (var i = 0, convertValuetoTime = document.getElementById("GridView1").getElementsByTagName("td")[i].innerHTML; typeof convertValuetoTime !== 'undefined' { var convertValuetoTime = document.getElementById("GridView1").getElementsByTagName("td")[i].innerHTML; alert(convertValuetoTime); i += 9;Above is a for loop that increments in 9, 9 being right number for the column. When I tried to find the length of the cells, I ended up with less than actual amount of rows. I believe it's due to how the gridview is loaded. I tried a bunch of things and the last thing I tried was the code above: keep going until convertValuetoTime is undefined, which works but I keep getting an error in firebug 'convertValuetoTime is undefined', so that makes me kinda worry about cross-browser compatibility.
  12. I couldn't do it with id since I'll be editing a table column, but I can with class.I'd prefer it without class to get a better separation of code.
  13. I'm having a hard time using asp.net's gridview, which basically outputs this html table for me.I'd like to use javascript in one of the columns of this html table, but I would like to avoid using css classes to get the value in this column.Is that possible?I'm thinking along the lines ofJavascript:ConvertNumber( <%# Eval("NumberToConvert") %> )
  14. I'm learning javascript and I'm not sure if I follow...I'm trying to replace all instances of a class with another class.http://jsfiddle.net/UW6R2/
  15. I've deleted the files to clean up a little bit, so I can't test if it was a quirks mode issue or not. Feel free to close this thread.
  16. I have been checking it with firebug. It doesn't report anything. I haven't thought about the two different versions of jQuery. The second line with document.write is a fallback in the case google's jQuery can't be accessed. I'll change it soon enough. Since I'm not testing it online, it doesn't seem to pick up Google's jQuery. I want the showy effects of images moving left to right. I suppose I'll try to make it myself, since you put it that way.
  17. Well, I've tried that and I can't seem to get it working. Maybe I'm overlooking something? <!doctype html><html lang="en"><head> <meta charset="utf-8"> <title>The HTML5 Herald</title> <meta name="description" content="The HTML5 Herald"> <meta name="author" content="SitePoint"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!--<link rel="stylesheet" href="css/bootstrap.css" media="screen" />--> <link rel="stylesheet" href="screen.css" media="screen" /> <link rel="stylesheet" href="handheld.css" media="handheld" /> <style> .jcarousel { position: relative; overflow: hidden; /* You need at least a height, adjust this to your needs */ height: 200px; } .jcarousel ul { width: 20000em; position: absolute; list-style: none; margin: 0; padding: 0; } .jcarousel li { float: left; } </style> <!--[if lt IE 9]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--></head><body> <p id="loginStuff">Welcome</p> <nav> <ul> <li>a</li> <li>a</li> <li>a </li> </ul> </nav> <div id="columnWrap"> <div class="left-col"><div class="jcarousel"> <ul> <li><img src="http://placehold.it/200x200" alt=""></li> <li><img src="http://placehold.it/200x200" alt=""></li> </ul></div> </div> <div class="right-col"> </div> </div> <div id="footer"> </div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script>!window.jQuery && document.write('<script src="jquery-1.9.1.js"></script>')</script> <script type="text/javascript" src="dist/jquery.jcarousel.min.js"></script> <script type="text/javascript"> $(function() { $('.jcarousel').jcarousel({ // Configuration goes here }); }); </script> <!--<script src="js/scripts.js"></script>--></body></html> All this shows is the two placeholder pictures by each other instead of a working carousel.
  18. Would anyone happen to know what files I need to get a working carousel? I downloaded Bootstrap 3.0.0. I copied the markup example from the doc and added jquery and carousel.js. It didn't work. I copied a working html markup carousel. The pictures and the javascript was there, but it's nowhere near a carousel. Added holder.js. Added transition.js. Added carousel.css I found in the examples folder. Gave up and took all of those away. Used Bootstrap.min.js and Bootstrap.css. Finally working. But I don't want to have the entire bootstrap js in there. I tried going back to the getbootstrap website, went to customize, untoggled everything except functioning carousel, and I'm back to what I had before I added holder.js.
  19. Cool. Tried overflow: hidden and it works. Thanks!
  20. I would say try using the em standard. I hear it's better to use em than px. http://v1.jontangerine.com/silo/css/pixels-to-ems/
  21. I googled it and people are using .nav and #nav, but when I switch out nav for either of the two, they stop working oddly enough. I must definitely be overlooking something here.
  22. <html><head><title></title> <style type="text/css"> * { margin: 0; padding: 0; } body { background: black; color: white; } #navbar { width: 100%; background-color: #56A4E8; padding: 0 10%; } nav { width: 800px; list-style: none; margin: 20px; padding: 5px 0 5px 0; } nav li { display:inline; list-style:none; margin:20px; padding:0 3%; } #navbar nav a { text-decoration: none; color: white; } #thing { background: grey; } #thing #wrap { width: 800px; margin: 0 auto; } #left-col { float: left; width: 48%; padding: 1%; } #right-col { float: right; width: 48%; padding: 1%; } h2 { color: #56A4E8; }</style></head><body> <div> </div> <div id="navbar"> <nav> <ul> <li><a href="#">content</a></li> <li><a href="#">content</a></li> <li><a href="#">content</a></li> <li><a href="#">content</a></li> <li><a href="#">content</a></li> </ul> </nav> </div> <div id="thing"> <div id="wrap"> <div id="left-col"> <h2>NEWS/EVENTS</h2> <hr /> <ul> <li>Kickstarter</li> <p>Like us on Facebook to earn points to win promotional items and other prizes. <a href="#">Click here</a> to learn more.</p> <hr /> <li>Announcements</li> <p>content</p> </ul> </div> <div id="right-col"> <h2>VIDEOS</h2> <hr /> <ul> <li>content<li> <li>content</li> <li>content</li> </ul> </div> </div> </div></body></html>
  23. * { margin: 0; padding: 0; } body { background: black; color: white; } nav { width: 100%; text-align: center; background-color: #56A4E8; list-style: none; margin: 20px 0 20px 0; padding: 5px 0 5px 0; } nav li { display:inline; list-style:none; margin:10px; padding:0; } #wrapwrap { background: grey; } #wrap { width: 800px; margin: 0 auto; } #left-col { float: left; width: 50%; } #right-col { float: right; width: 50%; } h2 { color: 56A4E8; } I validated it with http://jigsaw.w3.org/css-validator/validator It's all valid, but I don't see my grey background-color. Little help here?
  24. I'm trying to put a navigation menu at the top, but I don't understand something. Position: Absolute overlaps everything else. Position: Relative seems to throw out all of my formatting out the window and won't include line breaks. Why do I have to work around this positioning to accomplish some kind of header? <%@ Page Language="C#" AutoEventWireup="true" CodeFile="cssAttempt.aspx.cs" Inherits="cssAttempt" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>CSS ATTEMPT</title> <style> div { display: block; } div.top{ position: absolute; width:100%; color:white; background-color: black; } .top ul { list-style: none; } .top ul li { float:left; /*Hate: This centers*/ } .top a { display: block; text-decoration: none; } </style></head><body> <form id="form1" runat="server"> <div class="top"> <ul class="top"> <li>HOME</li> <li>ANYTHING</li> <li>ANYTHING</li> <li>ANYTHING</li> </ul> </div> <div> <h1>Hey</h1> <p>If you don't see Hey, that means it's been overlapped.</p> </div> </form></body></html>
×
×
  • Create New...