Jump to content

HawkDev

Members
  • Content Count

    8
  • Joined

  • Last visited

Community Reputation

0 Neutral

About HawkDev

  • Rank
    Newbie
  1. <html charset='ISO-8859-1'> <head> <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <script type="text/javascript"> function getBrowserName() { var name = "Unknown"; if(navigator.userAgent.indexOf("MSIE")!=-1){ name = "MSIE"; } else if(navigator.userAgent.indexOf("Firefox")!=-1){ name = "Firefox"; } else if(navigator.userAgent.indexOf("Opera")!=-1){ name = "Opera"; } else if(navigator.userAgent.indexOf("Chrome") != -1){ name = "Chrome"; } else if(navigator.userAgent.indexOf("Safari")!=-1){ name = "Safari"; } return name; } var datefield=document.createElement("input"); datefield.setAttribute("type", "date"); </script> </head> <body> <form> <b>Date of birth:</b> <input type="date" id="birthday" name="birthday" size="20" /> <input type="button" value="Submit" name="B1"></p> </form> <script type="text/javascript"> if(getBrowserName() == "Safari"){ jQuery(function($){ $('#birthday').datepicker(); }); } else { alert("You are surfing on " + getBrowserName(name)); } </script> </body> </html> Do you mean like this? There is no change in whether it is working.
  2. This problem is driving me nuts!!! I have checked using browser detection, and I can get the code to recognise the browser. I also managed to get it to load the jQuery as a consequence of that, but no matter what I do, I am not getting the drop down calendar that I was getting in the date picker field. I have checked that the type of the field is being recognised, and it is. It is just not producing the calendar. What could I possibly be doing wrong at this point? I created a brief sample of code to show the basic elements of what is in my code. Can you please explain where I might be going wrong? <html charset='ISO-8859-1'> <head> <script type="text/javascript"> function getBrowserName() { var name = "Unknown"; if(navigator.userAgent.indexOf("MSIE")!=-1){ name = "MSIE"; } else if(navigator.userAgent.indexOf("Firefox")!=-1){ name = "Firefox"; } else if(navigator.userAgent.indexOf("Opera")!=-1){ name = "Opera"; } else if(navigator.userAgent.indexOf("Chrome") != -1){ name = "Chrome"; } else if(navigator.userAgent.indexOf("Safari")!=-1){ name = "Safari"; } return name; } var datefield=document.createElement("input"); datefield.setAttribute("type", "date"); if( getBrowserName() == "Safari" ){ document.write('<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />\n'); document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"><\/script>\n'); document.write('<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"><\/script>\n'); } if(getBrowserName() == "Safari"){ jQuery(function($){ $('#birthday').datepicker(); }); } else { alert("You are surfing on " + getBrowserName(name)); } </script> </head> <body> <form> <b>Date of birth:</b> <input type="date" id="birthday" name="birthday" size="20" /> <input type="button" value="Submit" name="B1"></p> </form> </body> </html>
  3. Can I force it to use the jQuery work around anyway? This must be possible?
  4. I have been using a jquery work around for a datepicker which until today has been working perfectly. Suddenly, it has stopped functioning, so that the drop down calendar no longer appears. The code that I have used for the date picker is as follows: <script type="text/javascript"> var datefield=document.createElement("input"); datefield.setAttribute("type", "date"); if (datefield.type!="date"){ //if browser doesn't support input type="date", load files for jQuery UI Date Picker document.write('<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />\n'); document.write('<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"><\/script>\n'); document.write('<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"><\/script>\n'); } </script> <script> if (datefield.type!="date"){ //if browser doesn't support input type="date", initialize date picker widget: jQuery(function($){ //on document.ready $('#eventDate').datepicker({ dateFormat: "dd-mm-yy" }) }) } </script> In the past, this was always a work around for the lack of compatibility with the Safari browser. Has something changed?
  5. It is ok. I have managed to test a scenario using sessionStorage, and get the data to be recalled after a page refresh. I will now try to apply this to my situation.
  6. I tried using local storage, but I can’t seem to get the system to store the data, and then recall it on reload. Can you please give me a clear example of how this would work for multiple variables?
  7. Thank you. I understand that I can use an event handler like ‘onchange’. That is not difficult. However, what I am struggling with is how to save the data between the change of choice in the drop down menu, and the reload of the page.
  8. I have an online form, which has various dropdown lists. One of these is for names of clients, one is for the location, one is for time of appointment, etc. It also has a function to add items onto the dropdown lists if it is a new client. This means that the page has to be reloaded to repopulate the dropdown list with the new client name. However, there are a lot of different dropdown lists on the form, and if the page is reloaded, I want the particular selections that the user has already made to be reloaded when the page is reloaded, so that they do not have to start again just because one dropdown list needed to be edited. Can you please explain how to do this? Thank you.
×
×
  • Create New...