Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. jesh

    onload event

    No, in this case the load event will not fire. Perhaps you could use the click event for the link? <a href="#info" onclick="somefunction();">info</a>
  2. jesh

    onload event

    The load event fires when the document loads in the browser. If your page is called "index.html" and you have a hyperlink on that page that references "index.html", then, yes, when you click on that link, the page will reload, and the load even will fire.
  3. jesh

    Time Need Help

    Check out the javascript reference regarding the Date object:http://www.w3schools.com/jsref/jsref_obj_date.aspYou can easily get the UTC (GMT) time like so: var date = new Date();document.write(date.toGMTString());// document.write(date.toUTCString()); You can also use the getTimezoneOffset() method to figure out how many hours difference the client's computer is from GMT: var date = new Date();var timeDifference = date.getTimezoneOffset();
  4. jesh

    removing nodes

    You might try something like this: var box = document.getElementById("box");box.removeChild(box.lastChild); Check out the XML DOM tutorial as well. While the HTML DOM tutorial does a great job talking about the different methods and properties available to various HTML elements, the XML DOM does a great job talking about how to manipulate (e.g. add nodes, traverse nodes, remove nodes, etc.) the DOM.Another way, which may be a little more simple, would be to use the innerHTML property instead: function roll1(){ document.roll1p.src ="3.png";document.getElementById("box").innerHTML = "this is a test";} Then, to remove the text: document.getElementById("box").innerHTML = "";
  5. This function works for me, you might try it: function GetXmlHttpObject(){ 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;}
  6. There are three distinct variables in your code named "xmlHttp".1) the global xmlHttp variable declared on the first line of code.2) the local variable inside your startup() function.3) the local variable inside your GetXmlHttpObject() function.What's happening is that you declare a variable called xmlHttp (1) and then, at some point, startup() fires. This function creates a new xmlHttp variable (2) and instantiates that variable as an XMLHttp object. The function also sets up the readystatechange handler called stateChanged(). When stateChanged() fires, it is referencing that global xmlHttp variable (1) that has never been instantiated. Hence, "xmlHttp is not an object".Try this instead: var xmlHttp;function startup(){ xmlHttp = GetXmlHttpObject(); ...
  7. I think this is the best advice. If you aren't sure what an interviewer is talking about, ask that person to clarify. If I were hiring someone, I would rather the interviewee ask me what my question meant rather than spout out some answer that may have nothing to do with what I'm asking.
  8. That file may simply be corrupt on your computer at home. If you can open the file on other computers, try copying the file and emailing it to yourself. Then, when you get home, you can delete the file on your home computer and download the new version from your email. If it was a corrupt file, your problems should be solved.
  9. or this: <input type="file" onkeypress="blur();" onkeyup="blur();" onkeydown="blur();"/>
  10. You might want to post this in the PHP forum (or do a search there because I swear someone has recently asked this very question there).
  11. Alright, I'm back again. I gotta learn not to post here until after I've spent an hour or two searching...jeez.Found the solution here: http://forums.asp.net/thread/1406703.aspxYou have to dynamically create the event and fire it: if(document.createEvent){ var onchangeEvent = document.createEvent("HtmlEvents"); onchangeEvent.initEvent("change", true, false); document.getElementById("test").dispatchEvent(onchangeEvent);}else if(document.createEventObject){ document.getElementById("test").fireEvent('onchange');} Seems like a kludge, but it works for me on IE6, Firefox (PC and Mac), and Safari. Anyone seen any better solutions?
  12. Hmm, just saw on a Google search that I need to call the onchange function when I programmatically change a value to get the onchange event handlers to fire. window.opener.document.getElementById("test").onchange(); This, however, doesn't pass the DOM Event to that function. Any other ideas?
  13. Say you have the following page: <html><head><script type="text/javascript">function openwindow(){ var wnd = window.open(); wnd.document.open(); wnd.document.write("<html><body><scri" + "pt>"); wnd.document.write("window.opener.document.getElementById('test').value='New Value';"); wnd.document.write("</scri" + "pt></body></html>"); wnd.document.close(); wnd.close();}</script></head><body><input type="text" id="test" onchange="alert('changed!');" /><button onclick="openwindow();">Open Window</button></body></html> If you type text into the text box and change the focus to something else (e.g. click on the body somewhere), the onchange event for the text box will fire and "changed" will be alerted. However, if you click the button to run the javascript, a new window will be opened which will run some javascript to change the value of the text box to "New Value", the onchange event will not fire and there will be no alert.Is it possible to change the value of the text box from a child window and have the onchange event fire? Can anyone help explain to me why the event isn't firing in the element on the parent window when the change is originating from the child window?
  14. jesh

    Learn VBScript?

    OK, I'll agree with that. The first language (after BASIC) that I learned was VBScript so that I could learn VBA (this was 1998) in order to work on a project for my employer at the time. This knowledge did help me better understand how javascript worked. Then, through javascript, I learned more valuable languages such as Java and C#.In my person experience, I would suggest that you completely ignore VB, VBA, and VBScript and dive straight into javascript. If you want to move on to a more powerful language, learn C#. Once you know javascript and either Java, C/C++ or C#, it'll be relatively easy to learn VB (VBScript, VBA, etc.) if you require it for a certain project.
  15. jesh

    Adding Value

    Just so you know, that loop will continue forever until you either return or break out of it or you explicitly set "listed" to some value less than or equal to -1.The loop says "Starting at 0, increment 'listed' by 1 as long as it is greater than -1". Which is to say, "loop forever".
  16. Absolute positioning pulls (for lack of a better term) the element out of structure of the page and treats it similar to the way a float works. Absolutely positioned elements are positioned relative to the nearest containing element that has positioning set. If no container if found with positioning, it would be positioned relative to the body.Relative positioning moves the element relative to where it would normally appear in the structure of the page.e.g.: <style>.outer { position:relative; top:50px; left:50px; background-color: red; }.inner { position:absolute; top: 0px; left: 0px; background-color: green; }</style><div class="outer"><div class="inner">test</div>some random content</div>
  17. jesh

    Using Random Strings

    You could also keep a record of which random sequences you recently generated to avoid repetition.
  18. Ahh, I assumed you were building something for the web.
  19. You can use a cookie that expires. Then, the next time a request is sent to the server the server will check to see if there is a cookie in the request. If the cookie had expired, you could send the visitor to a login page (or a session expired page). And, to keep an active session active, on any page that required the user to be logged in, you could update the expire date for the cookie.
  20. Check out this page for information on how to use CreateTextFile to allow it to overwrite existing files:http://www.w3schools.com/asp/met_createtex..._filesystem.aspHowever, you're probably better off using OpenTextFile to attempt to open the file. There is an optional parameter in that function that will create the file if it doesn't already exist.http://www.w3schools.com/asp/met_opentextfile.asp
  21. I don't really have any experience in this field, but it seems to me that while, yes, you could hide data in any file (including images - check out digital watermarking and Steganography), you're not going to be able to hide an executable inside an MP3. That is, unless you also wrote the MP3 player software that can look for that hidden code and execute it.
  22. jesh

    Gridview

    I've never attempted to send mail from .NET using hotmail or any of the other free, web-based email providers but I found this link that may explain how to do it with GMail:http://www.andreas-kraus.net/blog/aspnet-2...ail-with-gmail/
  23. jesh

    mysql security

    Check out the documentation.Security: http://dev.mysql.com/doc/refman/5.0/en/security.htmlPrivilege System: http://dev.mysql.com/doc/refman/5.0/en/privilege-system.htmlUser Account Management: http://dev.mysql.com/doc/refman/5.0/en/use...management.html
  24. Check out jQuery: http://jquery.com/Some folks I work with were talking about it last night and they mentioned tree views and ajax. I haven't looked at it myself though.
×
×
  • Create New...