Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. jesh

    typing keyboard

    Yeah, I have a USB keyboard connected to my laptop at home. I can't stand the feeble keys on the laptop keyboard.
  2. I think you are looking for something like this: <script type="text/javascript">function open_win(url, name, width, height){ var windowProps = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,"; windowProps += "titlebar=no,resizable=no,copyhistory=no,width=" + width + ",height=" + height; window.open(url,name,windowProps);}</script> and this could be how you call it: <a href="http://67.40.250.86/~Willeyeam/Final.swf" target="_swfs" onclick="open_win('','_swfs',390,720);"><img src="thumbnail.gif" alt="TheThumbnail" /></a> I hope it helps!
  3. Will using the HTML DOM help? Specifically what's described in this link: http://www.w3schools.com/htmldom/prop_iframe_height.asp
  4. If you set the window name for the parent window using javascript and you open the child window using window.open(), you should be able to specify a name for the child window and access the parent window's name from within the child window.Here's an example: <html><head><script type="text/javascript">window.name = "TheParent!";function openIt(){ var wnd = window.open("","TheChild","width=300,height=200"); var doc = wnd.document; doc.open(); doc.write("<html><body>"); doc.write("This window is named: <scri" + "pt>document.write(window.name);</scri" + "pt><br />"); doc.write("The parent is named: <scri" + "pt>document.write(window.opener.name);</scri" + "pt><br />"); doc.write("</body></html>"); doc.close();}</script></head><body><a href="#" onclick="openIt();">Open new window</a></body></html>
  5. jesh

    Anyone know AJAX

    Hmm, I just don't know anything about cold fusion and how it would be possible to execute a function (that GetMenu cffunction) on the server from within the same page. In my experience (PHP, ASP.NET), you need a second page which handles all requests from AJAX calls. You send it parameters and it returns specific data based on those parameters. To get a cffunction to run on the same page that the AJAX request originates from, you'll probably have to turn to the Cold Fusion developers here.If it were me, I'd have a page on the server build the necessary output (i.e. a list of options delimited by some character like a comma or newline; or using XML) and then use that data to clear out the options in the second dropdown and populate it with the new options. var select = document.getElementById("process");var option;select.options.length = 0; // clear the options from the list.for(var i = 0; i < newoptions.length; i++){ option = document.createElement("option"); option.value = newoptions[i][0]; option.text = newoptions[i][1]; select.add(option, null);} The step missing above would be to convert the data that is returned by your page into a two dimensional array (called newoptions).
  6. jesh

    Anyone know AJAX

    When you say library file, are you referring to something like a class library? If so, it shouldn't be necessary. All the code that is needed to perform the AJAX request is in that code I provided combined with what is already built into the browsers (XMLHttpRequest() for most browsers and ActiveX stuff for IE).Here's an example of a webpage that would use AJAX. It requires some other page that handles the request and spits out some data based on parameters either POSTed to the page or provided in the query string. This would typically be a PHP page, an ASPX page, or a CFM (is that cold fusion? ) page. When I build these, I usually just return plain text because I don't feel like bothering with the XML, but that's up to you.First, I'd put all that javascript into a file - let's call it ajax.js. <html><head><script type="text/javascript" src="ajax.js"></script><script type="text/javascript">function DoSomething(somevalue){ // this URL is for the page that will handle the AJAX request. var url = "http://www.mysite.com/somepage.php?someparameter=" + somevalue; ajax_GetRequest(url, handleAjaxRequest);}function handleAjaxRequest(){ if(http_request.readyState == 4) { if(http_request.status == 200) { var text = http_request.responseText; document.getElementById("ResultDiv").innerHTML = text; } }}</script><body><div id="ResultDiv" /><a href="#" onclick="DoSomething('testing');">Click Me</a></body></html>
  7. jesh

    Working with php Include

    I know in javascript, HTML, and ASP.NET (C#), you can reference the root directory by placing a "/" in front of it (no dots).So, if you had a root directory and two sub directories - sub1 and sub2 - and you needed to link to a file - main.php - in an include that was on files on all three of those directories, rather than using "./", "../", etc, you should be able to use "/main.php" and they will look for "main.php" in your root directory./ = root directory./ = current directory../ = parent directoryI'm not sure if this is the same with PHP or not, but it's worth a shot.
  8. jesh

    OOP

    When I first learned about object oriented programming, I practiced using Javascript so that I could get a feeling for how it worked. This was totally instrumental in my being able to learn Java and C#. If I hadn't learned the concepts behind OOP, I would still be writing scripts rather than applications.
  9. You can, perhaps, also use stylesheets to format the page specifically for printing. Just create a new stylesheet and link to it on your page with something like this:<link rel="stylesheet" type"text/css" href="print.css" media="print" /> I use this method often. If there is some content in a container on the page that I don't want printed, I simply set the display for that container to "none". This way you only have to maintain two stylesheets rather than two PHP or HTML pages.
  10. jesh

    Anyone know AJAX

    Hmm, don't know anything about ColdFusion myself, but here's the javascript I use for my AJAX stuff. I hope it helps! Only thing to keep in mind here is that both the page that the visitor is on and the page that the AJAX request goes off to must be in the same domain (i.e. www.mysite.com): var http_request;function getHttpObject(){ 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;}function ajax_GetRequest(url, handler){ http_request = getHttpObject(); if(http_request) { http_request.onreadystatechange = handler; http_request.open("GET", url, true); http_request.send(""); }}function ajax_PostRequest(url, handler, data){ http_request = getHttpObject(); if(http_request) { http_request.onreadystatechange = handler; http_request.open("POST", url, true); http_request.setRequestHeader("Content-Type", "application/x-www-urlencoded"); http_request.setRequestHeader("Content-Length", data.length); http_request.setRequestHeader("Connection", "close"); http_request.send(data); }}function sample_ajax_Handler(){ if(http_request.readyState == 4) { if(http_request.status == 200) { var text = http_request.responseText; //var xml = http_request.responseXML; // do something with text (or xml). } }}// Here is what a call would look like:ajax_GetRequest("http://www.mysite.com/mypage.html", sample_ajax_Handler);
  11. jesh

    Update

    You have a "WHERE InfoFinanceira.infoid=207" in your UPDATE query. Is there more than one record in your table with an infoid of 207?
  12. Have you tried the offsetWidth and offsetHeight properties of the element? var obj = document.getElementById("myElement");var width = obj.offsetWidth;var height = obj.offsetHeight;
  13. It's part of the HTML DOM. var select = document.getElementById("slctreasons");var option = select.options[select.selectedIndex];var text = option.text;var value = option.value;
  14. You could do it something like this: var pees = document.getElementsByTagName("p");var p;for(var i = 0; i < pees.length; i++){ p = pees[i]; p.innerHTML = "<strong>" + p.innerHTML + "</strong>";} However, I would personally go along this route instead: <style type="text/css">p { font-weight: bold; }</style>
  15. OK, maybe you can explain this to me or point me to a link that explains it. I've started to notice things like -width and _margin lately. What's going on there?
  16. jesh

    Anyone know AJAX

    What are you hoping to do?
  17. For SQLServer, I usually do it something like this. Other databases may use a slightly different Connection class (i.e. System.Data.OdbcConnection).First, make sure your class references the following: public bool Exists(int id){ bool exists = false; using(SqlConnection connection = new SqlConnection("CONNECTION STRING GOES HERE")) { // I usually use Stored Procedures, but this will work too... SqlCommand command = new SqlCommand("SELECT MyID FROM MyTable WHERE MyID = " + id, connection); command.CommandType = CommandType.Text; try { connection.Open(); object result = command.ExecuteScalar(); if(id == (int)result) { exists = true; } } catch(Exception e) { // do whatever exception handling you require. } command.Dispose(); } return exists;}
  18. Like this? Set fs=Server.CreateObject("Scripting.FileSystemObject")Set f=fs.OpenTextFile(Server.MapPath("testread.txt"), 1)do while f.AtEndOfStream = falsetextline = textline & f.ReadLine & "<br />loop If all you are doing is converting the line breaks to "<br />", you might try something like this: text = Replace(text, "\n", "<br />");
  19. Here's a link to an article that might further explain aspnetguy's method:http://www.codeproject.com/aspnet/creditcardvalidator.asp
  20. You'll also need to specify which column you'll be sorting off of in the SQL query: SELECT * FROM tblExample ORDER BY columnName DESC
  21. How about something along these lines? function Menu(id){ this.id = id; var obj = this; this.expand = function() { document.write(obj.id + "<br />"); setTimeout(obj.expand, 500); }}var test = new Menu("Hello World!");test.expand(); I can't say how you would specifically tie it in with your code, but this is one way to send parameters through the setTimeout method.
  22. What kind of data are you attempting to pass to the function? Do you have an example? And can you describe in a little more detail a situation where you would want two (or more) of these loops running at the same time?
  23. I've also run into this problem before. If the value in functionVar is a string (as opposed to a pointer to an object or function), you might try something like this: setTimeout("myFunction('" + functionVar + "');", 2); Alternatively, you might try setting a global variable and then passing it to the setTimeout method: var myVar;function myFunction(functionVar){ myVar = functionVar; t = setTimeout("myFunction('" + myVar + "');",2);}
  24. My question is, if you are using "document.calc." to get at the form elements to perform your calculation, why can't you put those form elements in your "submitJobForm" form and use "document.submitJobForm." to access the elements?The onchange event handler will still perform the calculations for you, regardless of what form it is in.
  25. Why do you need two forms? You're not actually submitting your "calc" form are you? Just keep with the onchange event handler to perform the calculation and put all of those inputs in your "submitJobForm".
×
×
  • Create New...