Jump to content

Emwat Oon

Members
  • Content Count

    27
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Emwat Oon

  • Rank
    Newbie
  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/
×
×
  • Create New...