Jump to content

Saeed

Members
  • Content Count

    9
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Saeed

  • Rank
    Newbie
  1. Good Day and Happy New Year. I'm trying to set the focus to a text field with this code:<body onLoad="document.formname.fieldname.focus();"> // (sorry, inserting the Codebox generated Invalid Argument in ips_text_editor.js.)<A name=OLE_LINK1>It kind of works! The focus is in the field, but not the cursor. That is, I don't see the I-beam in the field, but when I type a value, it appears there.The value entered in the field is then used to search for a database by clicking a button.And now the questions:1. Why is the cursor not blinking in the field although it has the focus?2. If the search returns a value (it is displayed outside of the field), the focus is lost. I tried putting the same code as above in the onClick event of the button, something like this:<input type="button" onClick="doWork();"><script> function doWork () { do the search; document.formname.fieldname.focus(); } </script> The script is within the <head> tags. The search works, but the focus is not set back to the field. How can I re-set the focus?3. If the page is reloaded, the focus is lost. Again, how to re-set it to the filed. Thank you for your help.
  2. Good Day,Is it imperative to embed a JS script in an HTML page in order to execute the code? or is it possible to somehow run a script the way one would do a Java code from the command line?
  3. Good Day,I am really baffled: I just saved a file with .htm extension but without <html></html> or <body> tags. And it works! I mean it gets displayed. Even a button can be placed and the onClick method would work. I'm using IE6; tried it with IE7, same thing. Even the little Perl script and "submit" worked (XAMPP is installed on the IE7 machine).There must be very good reasons for having those tags; please share them with me. Thanks.
  4. Merci beaucoup dsonesuk!That's exactly what I was asking for!Thanks again and have a nice weekend.
  5. Good Day,I'm learning JS and CSS; to practice, I wrote a function to loop thru all rgb values and assign them to the backgroundColor property of a div: <script type=text/javascript><html><head><script type="text/javascript">function cs (){ var obj = document.getElementById('t'); var tmp = ["0", "0", "0"]; var a = tmp[0]; var b = tmp[1]; var c = tmp[2]; var clr; for (i=0; i<256; i++){ a = i; for (j=0; j<256; j++){ b = j; for (k=0; k<256; k++){ c = k; clr = "rgb(" + a + ", " + b + ", " + c + ")"; obj.style.backgroundColor = clr; } // end of k } // end of j } // end of i alert (clr); // just to c if it worked} // end of function div{ background-color:#b0c4de;}</script><style type="text/css">div{ background-color:#b0c4de;}</style></head><body><div id="t"> This is a text inside a div element.</div><input type="button" value="color" onClick="cs();"></body></html> This snippet seems to work, albeit very slowly.Here are my questions: Is the code ok? If I use other values for the loop variables, it doesn't seem to work. I put an alert() right b4 the color assignment just to see if the loop works. I used <100 as the break condition and incremented the loop variables by 10. Strange thing happened:the loop repeated itself! The alert box would show (90, 90, 90) and then starts from "0" again.What could be causing this? What is a better alternative for displaying the loop variables while it's looping? document.write() overrides the whole page and stops the loop. I'd like something like:"now displaying the color value abc" to be shown without interrupting the count. Thank you and a good weekend.
  6. Good Day Deirdre's Dad,Thanks for your reply. However, 1. The pages are on an intranet, and thus not accessible from outside. I did try to somehow describe the setup, obviously not very successfully! Let's see if this one's any better: Basically by clicking a button, the following script is executed: function toggle (checked) { document.getElementById('tree').src = (checked) ? 'image1.gif' : 'image2.gif'; }Initially, image2.gif is displayed and "checked" is true; it is defined in another file. So, at first click, image1.gif should be shown. But it is not. It is there but invisible.The script does few other things as well; which work properly. 2. This is a legacy project, frames et. al. are stipulated by the customer.3. As for my skillset, you are right; it does need to grow in the directions mentioned.
  7. Good Day, I have a page with 3 horizontal frames. The middle frame is in turn divided into 2 vertical frames and the right frame again into 2 horizontal ones; it looks something like this: ___________________________________________________________ |..........................................header frame......................................||__________________________________________________________||.........|...............................optionsframe..................................||.........|____________________________________________________| |....left.|.................................................................................||..frame|......................................basefrm..........................| |______ |__________________________________________________| |........................................ footer frame...................................| |__________________________________________________________| The contents of the "basefrm" are the dynamic and selected via the JS generated Treeview in the "left frame". The contents of the others are static. (the dots in the graph are for display purposes only; blanks are deleted.)In order to provide a larger viewing area for the main themes in "basefrm", a button is placed in the "options" frame; by "onClick ()" the column width of the "left frame" in parent is set to "0". Another "onClick ()" restores the original size. Following problem showed up: The first "onClick ()" reduces the "left frame", but the button is no longer visible; it has to be right-clicked and "Show Picture" is to be selected. Then the button becomes visible and all seems to be fine. But any time a new page is opened, this procedure must be repeated. This situation doesn't show up when the pages are on the same PC, i.e. no server is accessed. Here are my questions: 1. What could cause the problem? 2. How can I inquire the current document in the "basefrm", as mentioned, it is selected by the user from the entries in the "left frame"? (This question is not directly relevant to the problem at hand; but nevertheless is useful in case other possibilities are to be explored.) Thank you and have a good day.
  8. You're right, there's no such a thing as <id> or for that matter <class> element; they are both attributes, sorry. Thank you for the explanation about <div> & <span>. Please explain as well the different usage of <id> & <class>. The explanations on w3schools.com read rather similar. They both can be used by a JS script as well as styles.
  9. Good day,After more than 12 years, I've been thrown back to website design and maintenance. So a lot of newer HTML constructs are, well, new to me! I'd very much appreciate your support in getting up to speed. Here's my question:It seems to me that <div>, <span>, <class>, <id> (missed any?) do more or less the same thing, namely formatting the text following them. <div>, <span> are apparently local; the other 2 rather global. Is it so?Could you please describe the differences? What are the criteria for picking one over the other?Thanks.
×
×
  • Create New...