Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. Depending on how many images are on your page, you can cut down on a lot of text if you declare the image borders in the CSS rather than in-line with the img tag. <style type="text/css">img { border: 0px solid #000000; }</style> Or, if you only want to turn off borders for images that are in links: <style type="text/css">a img { border: 0px solid #000000; }</style>
  2. jesh

    Whoa...

    Hmm, as long as nobody puts a giant laser up there!
  3. I had only recently started trying out the for(i in array) loops but they don't quite act the same way as foreach(x in array) would in C# or PHP so I'll quit playing around with them and stick to the traditional for loops.
  4. I conducted a test with the following code: <html><body><form><input type="checkbox" id="check1" /><input type="checkbox" id="check2" /><input type="checkbox" id="check3" /><input type="checkbox" id="check4" /><input type="checkbox" id="check5" /></form><script type="text/javascript">var inputs = document.getElementsByTagName("input");for(var i in inputs){ alert("For-In: i = " + i);}for(var i = 0; i < inputs.length; i++){ alert("Typical For: i = " + i);}</script></body></html> On IE in WindowsXP, and Firefox on XP and on the Mac, both for loops execute. However, on Safari, only the second for loop executes. Can someone please verify this for me and perhaps point me to a link which explains it in greater detail?Thanks!
  5. I believe it has something to do with the width: 100% and padding: 10px 20px. I don't know the specifics, but some browsers - using certain doctypes - render padding differently than other browser.
  6. jesh

    SQL --> C# viewBox1

    Help me out here, of which class is the "viewBox1" object an instance? Is it a Web Control or a Windows Control?
  7. jesh

    merging searches?

    I have a search form on one of my pages whiches search through help tickets by either Reference #, Date, Email Address, or keyword search of the contents. I also chose the dropdown list route.In my codebehind (C#) I have a switch which detects the selected value of the dropdown list and then tells my search functions (I have more than one...but that doesn't matter) what stored procedure to use. This isn't exactly how I do it - I have a more OOP approach - but this conveys the idea:string procedure = String.Empty;switch(SearchType.SelectedValue){ case "RefNo": procedure = "DoSearchByReferenceNumber"; break; case "Date": procedure = "DoSearchByDate"; break; case "Email": procedure = "DoSearchByEmail"; break; case "Search": procedure = "DoSearchByKeyword"; break;}DoSearch(procedure, txtSearch.Text);
  8. I would add a third example which helps if the string that you want to write is pretty long:var message = '<font size="4" face="arial" color="blue">Whee!</font>';document.write(message);
  9. Check out the "name" attribute of the anchor (<a></a>) element. Also, look into using the hash mark ("#"). It's explained in the HTML tutorial in the section entitled: "The Anchor Tag and the Name Attribute". Here's the link: http://www.w3schools.com/html/html_links.aspBasically, this is saying that you can create links to different sections in your page. Here's an example: <body>// lots of content goes here<a name="section5"></a>// more content...<a name="section10"></a>// more content</body> Then, in your dropdowns, if your page was called "mypage.html", it could look like this: <select onchange="golinks(this.options[this.selectedIndex].value)"><option value ="mypage.html">-Select -</option><option value ="mypage.html#section5">Section 5</option><option value ="mypage.html#section10">Section 10</option></select>
  10. jesh

    XMLHttpRequest

    So, I tested this out a bit and it seems to be working just fine. If I copy this file (http://www.w3schools.com/xpath/books.xml) and put it on my local web server, I can use AJAX to get the XML and can use the XML DOM to get at specific elements within the XML: var xml = xmlhttp.responseXML;var books = xml.getElementsByTagName("book");var div1 = document.getElementById("div1");var div2 = document.getElementById("div2");div1.innerHTML = books[0].getElementsByTagName("title")[0].childNodes[0].data;div2.innerHTML = books[1].getElementsByTagName("title")[0].childNodes[0].data; This puts "Everyday Italian" in the contents of div1 and "Harry Potter" in the contents of div2. There's bound to be a better way to do this, but, like I said, I don't play much with XML. Maybe someone else here will have a better idea.
  11. jesh

    hex editing

    Hex editing is usually used to crack a piece of software so that it does something different than the original functionality of the software. Each file being cracked is unique from every other cracked file. I think you're on your own for cracking that file. Maybe you could look for an XBOX forum.Here's a wikipedia article on Hex Editors: http://en.wikipedia.org/wiki/Hex_editor
  12. Can you post a link to your page? Or, lacking a link, can you post your CSS as well as the HTML?
  13. jesh

    XMLHttpRequest

    If you have multiple text files, you're going to have to send multiple requests to get those text files - one request per file. Since you are already able to do one request and populate the contents of the text file into the div, it shouldn't be too hard for you to figure out how to do one separate request for each text file and then populate the contents of each of those files into your separate divs.Alternatively, as you suggested, you could make one request for an XML file and then use some means of parsing the XML file into the appropriate sections and displaying the contents of those sections into multiple divs. I don't play much with XML, so I'm not able to help you much there. I believe the the XMLHttpRequest returns an XML object if you use the .responseXML property (rather than the .responseText property). If so, you may be able to use the XML DOM to parse that XML object. Check out the tutorial here:http://www.w3schools.com/dom/default.aspFurthermore, the getElementById() method can only get a single element. It is not possible to pass multiple ids to that method. If you wanted to get three elements, you'd have to call that method three times: var div1 = document.getElementById("div1");var div2 = document.getElementById("div2");var div3 = document.getElementById("div3");
  14. It looks like you are using MySQL. Save yourself some time writing a new searching algoritm by using MySQL's FULLTEXT searching instead.Here's an article explaining it:http://www.onlamp.com/pub/a/onlamp/2003/06/26/fulltext.html
  15. jesh

    XHTML and Tables

    If you are actually presenting tabular data - like a spreadsheet - then, by all means, use a table to display that. If you are laying out your site look at aspnetguy's post: I, too, have problems still getting divs to work the same way I would expect out of tables. Sometimes I give up and resort to tables. However, like aspnetguy said, maintaining pages which use table-based design can be a nightmare! I can't tell you how many times I've taken over someone elses code and had to resort to turning on and off colored borders on all the tables just to see where one piece of content is. With divs, it's all well organized. And it gets easier the more you do it.
  16. jesh

    Iframe help.

    If you've tried target and it doesn't work, look into using the scrollTo method of the HTML DOM:http://www.w3schools.com/htmldom/met_win_scrollto.asphttp://www.w3schools.com/js/tryit.asp?file...window_scrolltoYou can call the scrollTo method on your iframe object: var myFrame = document.getElementById("myFrameID");myFrame.scrollTo(0, 500); After you scroll the frame, perhaps you could then hide the scrollbars: myFrame.style.overflow = "hidden";
  17. Can't you also simply use target? <a href="framesrc.html?#bottom-of-page" target="myFrame">Go to bottom</a><iframe name="myFrame" id="myFrame" src="framesrc.html"></iframe>
  18. If you are using float to position the elements within that div, you're going to have to use a clear in order for the div to stretch to a size that is big enough to display all of the floated elements.Try adding this after your floated elements and just before the closing div tag: <br style="clear: both;" /> You might have to play around with that a little, but it should help.
  19. You might also look at this post, there are a couple of methods mentioned there for using CSS to put borders on tables.
  20. You might try something like this instead: <div id="Main"> <div id="LeftShadow"></div> <div id="RightShadow"></div> <div id="Content">...Rest of Code... </div></div> In the code you posted, you had the RightShadow div nested within the LeftShadow div and all of the content was nested in the RightShadow div. I would imagine that would mess up the float actions. If you had a main div which held the shadows and the content - each as separate elements - you could float the left shadow left and the right shadow right and the content should stay in the middle.Hope this helps.
  21. If you don't mind using a little javascript, you can check out the HTML DOM, specifically the innerHTML property. You could write a function which changes the innerHTML of an element (a div perhaps) when you mouseover/click on something else on the page. Something like this:<script type="text/javascript">var display;function updateDisplay(text){ // first, we get the DOM object for your display div. display = (display) ? display : document.getElementById("display"); // then we change the innerHTML to be whatever we passed as "text". display.innerHTML = text;}</script><img src="someimage.jpg" onmouseover="updateDisplay('How do you like this image?!');" /><div id="display"></div>
  22. @aspnetguy - Here's an AJAX library I just put together for you. Feel free to add this to your Zoodles library - just add a little credit to my name, OK? :)I don't yet know how to attach files (can anyone explain to me how this is done?) so here it is in a codebox: /*---------------------------------------------------- * Name: Jesh's Ajax Library * Version: 0.1 * Date: December 8th, 2006 * Author: Josh Sorem * Notice: For free use and redistribution with this * notice attached. * Copyright 2006-2007. All rights reserved. *---------------------------------------------------- * Usage: There are two ways to use this library - synchronously and asynchronously. Synchronously: ============================================== // option 1 alert(Ajax.Get("http://theURL/thefile.ext").Text); // option 2 var response = Ajax.Get("http://theURL/thefile.ext"); if(response.Status == 200) { alert(response.Text); } ============================================== Asynchronously: ============================================== function myCallbackHandler(response) { if(response.Status == 200) { alert(response.Text); } else { alert("Error: " + response.Status + " " + response.StatusText); } } Ajax.Get("http://theURL/thefile.ext", myCallbackHandler); ============================================== To POST data, make sure that the data is in the following format: key1=value1&key2=value2 var data = "key1=value1&key2=value2"; Ajax.Post("http://theURL/thefile.ext", data, myCallback);*/// The main Ajax Object. var Ajax = new AjaxRequest();function AjaxRequest(){ // Private - This is the XMLHttpRequest object. var _httpRequest = GetHttpRequestObject(); // Public - This method sends a GET request to a specified URL. // If you specify a callback function, the request will go // out asynchronously and your function will be called // when the request has completed. Otherwise, the script // will wait for the response and return the Response object. this.Get = function(url, callback) { if(_httpRequest) { if(callback) { _httpRequest.onreadystatechange = function() { HandleAjaxRequest(callback); }; _httpRequest.open("GET", url, true); _httpRequest.send(""); } else { _httpRequest.open("GET", url, false); _httpRequest.send(""); return new AjaxResponse(); } } } // Public - This method sends a POST request to a specified URL with // the specified data. If you specify a callback function, the // request will go out asynchronously and your function will be // called when the request has completed. Otherwise, the script // will wait for the response and return the Response object. this.Post = function(url, data, callback) { if(_httpRequest) { if(callback) { _httpRequest.onreadystatechange = function() { HandleAjaxRequest(callback); }; _httpRequest.open("POST", url, true); _httpRequest.setRequestHeader("Content-Type", "application/x-www-urlencoded"); _httpRequest.setRequestHeader("Content-Length", data.length); _httpRequest.setRequestHeader("Connection", "close"); _httpRequest.send(data); } else { _httpRequest.open("POST", url, false); _httpRequest.setRequestHeader("Content-Type", "application/x-www-urlencoded"); _httpRequest.setRequestHeader("Content-Length", data.length); _httpRequest.setRequestHeader("Connection", "close"); _httpRequest.send(data); return new AjaxResponse(); } } } // Private - This is the Response object. It's properties, as listed below, // are "Text" and "XML" which are the response data from the // server (in text and xml formats respectively) and "Status" and // "StatusText" which are the HTTP Status Code and HTTP Status Message // from the server's response. function AjaxResponse() { this.Text = _httpRequest.responseText; this.XML = _httpRequest.responseXML; this.Status = _httpRequest.status; this.StatusText = _httpRequest.statusText; } // Private - This is the handler which listens for the onreadystatechange event // of the XMLHttpRequest object. This handler waits for the request // to end and then sends the AjaxResponse object to your callback function. function HandleAjaxRequest(callback) { if(_httpRequest.readyState == 4) { callback(new AjaxResponse()); } } // Private - This function determines which method to use to set up the // XMLHttpRequest. Should be cross-browser compatible. function GetHttpRequestObject() { var object = false; if(window.XMLHttpRequest) { object = new XMLHttpRequest(); } else if(window.ActiveXObject) { try { object = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { object = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { } } } return object; }} Examples on how to use it are in the script, but for clarity, here it is another example: var myDiv = document.getElementById("myDiv");myDiv.innerHTML = Ajax.Get("http://theURL/thefile.ext").Text;
  23. Firefox handles .png transparency just fine. IE, unfortunately, does not. This article might help you:http://www.alistapart.com/stories/pngopacity/
  24. You might put that window opening script in a onsubmit handler. Something like this:<script type="text/javascript">function validate(formobj){ var isValid = false; // do whatever you need to do to make sure you // want the user to be able to submit the form // (e.g. all the required fields have data) // let's assume everything validates: isValid = true; if(isValid) { // window.open code can go here. this will make // it so that the window only opens when the form // is actually submitted. } // if you return false here, the form won't be submitted. // if you return true here, the form will be submitted. return isValid;}</script><form method="post" action="thePostPage.php" onsubmit="return validate(this);"></form>
  25. If you use AJAX, it helps to have a toolkit built for that. Maybe another one to add event listeners to the page so it's easy to add onclick (onmouseover, onload, onmousemove, etc.) handlers to the DOM.I like your Request.QueryString parser. Brilliant!
×
×
  • Create New...