Jump to content

jesh

Members
  • Posts

    2,293
  • Joined

  • Last visited

Everything posted by jesh

  1. You could use location.href to send the visitor to a different site if s/he clicks cancel rather than writing "You pressed the Cancel button!". location.href = "http://www.w3schools.com";
  2. jesh

    CSS Woes

    OK, here's my problem, I want to use a div element which contains two items. One item is displayed on the left side of the div and the other item is displayed on the right side of the div. If I were using (nested) tables, I would do something like this: <table cellspacing="0" cellpadding="0" border="0"> <tr> <td align="left">Item 1</td> <td align="right">Item 2</td> </tr></table> Any tips on how to do this in CSS without using tables? I'm tired of mucking around with this and have other things I need to get done.
  3. jesh

    Time Showing

    First tip is a general one: if you find yourself repeating code then separate it out into its own subroutine. For example, if you are displaying "7am_10am.jpg" between the hours of 0700 and 1000 regardless of the day of week or the week of the year, then separate out that code. Figure out what image to display based on the time of day before you delve into determining which day of the week it is or what week of the year it is.Same goes with the day of week code. If you are doing the same thing for every Sunday regardless of the week, then separate out that code so that you don't have to repeat that code for every week.
  4. So you can get the information from the other file but you are running into the problem of being able to change the options for your select menu? You'll want to look into the DOM. I think both the HTML DOM and XML DOM tutorials will help you.Basically, if you want to change the options that are in the "Cities" select menu, you'll want to perform the following steps:1) Clear out the options for the "Cities" menu: document.getElementById("Cities").options.length = 0; 2) Determine how many cities you need to add to the menu from the information you received through your AJAX request.3) Run a for loop that runs once for each city and add the option to the select menu. Some javascript like this: var select = document.getElementById("Cities"); // this is your select menuvar citycount = cities.length; // cities is your array of cities that you got from AJAXvar i;for(i = 0; i < citycount; i++){ select.options[i] = new Option(cities[i], cities[i]);} I haven't tested this so it may not work exactly as posted. You can check out these links for more info:http://www.quirksmode.org/js/options.htmlhttp://javascript.internet.com/forms/adding-options.htmlhttp://www.petenelson.com/aspwatch/ASPWatc...ect%20Lists.htm
  5. jesh

    document.write

    You could do something like this: <script type="text/javascript"> document.write('<span class="myclass">Portfolio</span>');</script>
  6. jesh

    Code Reuse

    In C# (I don't know VB) I would do something like this: namspace UtilityFunctions{ public class SQLFunctions { public static string MakeSafe(string unsafeString) { // whatever you do to make the string safe. } }} Then, to use it in another class/page, you would do something like this: using UtilityFunctions;public class MyOtherClass{ public void DoIt(string unsafeString) { string safeString = SQLFunctions.MakeSafe(unsafeString); }} I hope this helps!
  7. When a session is created for a user, a unique SessionID is created by the server for that session. Any data that is stored on the server for a particular session (like the contents of a shopping cart) have a reference to that SessionID. This data is stored in the memory of the server.When a user sends a request to the server, the server has to be told the SessionID for that user's session. The way most web applications deal with this is either appending a special code to the URL or by storing the SessionID value in a cookie on the users computer. The server reads that code and then loads up the session data.
  8. This link may help: http://www.ibdhost.com/help/path/
  9. jesh

    Please Help Me

    Have you looked at the manual? http://www.php.net/gdThere's a section there about installing the GD library.
  10. I think you may have three options.1) You could send all of the data to the page when it is first downloaded and then use javascript and css to display/hide options based on what the user has selected.2) You could use AJAX to send a request to some ASP page which accepts the selected value of the country menu and then returns a list of cities to display. For more info on AJAX, check out Jhecht's post at http://w3schools.invisionzone.com/index.php?showtopic=79993) As you mentioned, you could submit the form when the value of the select changes and return the form to the user with the other select menu filled.
  11. Maybe these links'll help:http://www.developerdotstar.com/community/node/347http://www.thescripts.com/forum/thread82439.html
  12. jesh

    List Fixing

    The HTML that you posted is being cut off. I think because there is too much of it to post on this forum at once. Perhaps if you simplified the code a bit and posted that, someone here could copy it into a new html file and test it for you.Also, posting a screenshot of what you are seeing may be enough for someone here to suggest an answer.
  13. The way I look at it, if a website was designed to look good at 800x600, and my monitor is set to 1600x1200, I can always shrink my browser window so that the view port of the browser is closer to 800x600. But even then, I rarely make my window smaller than 1024x768 any more. The only time I set it to 800x600 is for testing the design of a site.I, personally, try to make my pages look a little squished (i.e. no wasted space) at 800x600, just about right at 1024x768, and a little sparce (i.e. lots of wasted space) at resolutions above that.
  14. jesh

    Adding dates

    http://www.w3schools.com/js/js_obj_date.asp I think if you change the last line of your code to something like the following it should work:seedDay.setDate(seedDay.getDate() + daysSince);
  15. Here's the CheckForEnter script I use. I don't think it works in Safari on the Mac yet - I've been too busy to try to get it to work. But it works for me in IE and Firefox (PC and Mac). function CheckForEnter(e){ var charcode; if(!e) { e = event; } if(e.which) { charcode = e.which; } else { charcode = e.keyCode; } if(charcode == 13) { // ENTER was pressed. }}
  16. Where you able to follow along with the tutorial so that a cookie was being written to your computer? If so, you can store the current date as the value of the cookie rather than the "username" and call the cookie something like "LastVisit".The new "checkCookie" function could look like this: function checkCookie(){ // we'll use displaytext to display the text to the screen. var displaytext = "Welcome"; // here we try to get the cookie. lastvisit = getCookie("LastVisit"); if(lastvisit != null) { // we found the cookie. Let's add some more text to our message displaytext += " back. Your last visit was on " + lastvisit; } else { // there wasn't a cookie, let's set one and assign the current date as the value. setCookie("LastVisit", new Date(), 365) } // now we'll write the message to the screen. document.write(displaytext);} For more elaborate ways to get the text displayed to the screen, I would suggest looking at the HTML DOM Tutorial and learn about the "innerHTML" property.
  17. I'm not quite sure what you're going for there, but maybe this'll help (I haven't tested this, but it should be close): <div id="caption" /><img id="display" align="middle" /><script type="text/javascript">// do whatever code you do to generate the random number// and/or recieve user input.var someNumber = 1; // you would have your code assign some value herevar captionObj = document.getElementById("caption");var displayObj = document.getElementById("display");switch(someNumber){ case 1: // someNumber == 1 captionObj.innerHTML = "JACKPOT!"; displayObj.src = "dracula.jpg"; displayObj.width = "1024"; displayObj.height = "576"; displayObj.alt = "JACKPOT!"; displayObj.border = "0"; break; case 2: // someNumber == 2 break; default: break;}</script>
  18. No problem! That tutorial helped me a lot too. I refer to it quite often. Try these articles. They should help.http://www.alistapart.com/articles/horizdropdowns/http://www.alistapart.com/articles/dropdowns
  19. What everyone is saying is that you need to change your Stored Procedure so that you look up the category based on some unique identifier (that doesn't change). Perhaps something like this: CREATE PROCEDURE SP_Updatecategorylist(@CategoryID int,@CategoryName varchar(50))ASUPDATE categorylist SET CategoryName = @CategoryName WHERE CategoryID = @CategoryID Perhaps the SQL Tutorial might help.
  20. Once the page is rendered on the visitor's browser, communication with the server stops until the visitor sends another request. Therefore, if you don't want the entire page to refresh, you'll need to use some type of client-side code to change the content. I think Javascript and/or AJAX would be your best bet.
  21. Have you looked at the Javascript Cookie Tutorial?
  22. You might try the HTML DOM to do this: <div id="dateDisplay" /><script language="javascript" type="text/javascript"><!-- var today = new Date(); var weekDayName = new Array ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); var monthName = new Array ("January","February","March","April","May","June","July","August","September","October","November","December");function printDate(){ var obj = document.getElementById("dateDisplay"); obj.innerHTML = weekDayName[today.getDay()]+ ", " + monthName[today.getMonth()] + " " + today.getDate();}--></script>
  23. jesh

    drop down menus

    That appears to be the notorious IE select & z-index bug. It is, as far as I know, not possible to get the selects to appear behind any other content, no matter what z-index you assign it. If anyone knows otherwise, I'd love to hear it.Check it out on Google.
  24. jesh

    HTML table

    Something like this? <tr> <td width="37%" bgcolor="#000080" height="63"> <p align="center"><b><font color="#FFFFFF" size="7"><?php echo $ProfitEarned; ?></font></b></p>
  25. jesh

    New to HTML

    Check out the XHTML tutorial on this site. Get in the habit of closing all of your HTML tags and using lowercase characters instead of UPPERCASE. (<p></p> rather than <P></P> and <br /> rather than <BR>)Also, if you are able to do something that was a significant challenge for you, make sure you add comments to the code so that if you return to it at a later time it will help you remember how you accomplished it.
×
×
  • Create New...