Jump to content

littleMe

Members
  • Posts

    3
  • Joined

  • Last visited

littleMe's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. HeyFirst of all I’m still a newbi so sorry for my ignorance I have a page that displays a bunch of data split over several lines.The data is a list of tasks that can be performed. Every line contains information about each task and a button you can press when you have started working on the task.After you push this button you get the option to close the selected task. When you choose to do this you get a form with a text field and a submit button. In this text field you are suppose to fill in some notes about the task you have completed.The problem occurs at this point. Since all the data is fetched form a sql database, I print the lines using a FOR loop in my php file. After you press submit the data is sent to a javascript function then sent to another php file that updates the sql db with the new data. All this is done to prevent page refresh (ajax). If you only open one of these forms at the time there is no problem but if you open several forms at once this causes trouble. So I think the problem will be solved by giving each dynamically created form a unique ID so I can separate them from each other. But now I have a problem with the javascript that the form data is submitted to. If I have one id for all the forms it looks like this (form id=myForm): function submitFormWithAjax(){ var myAjaxPostrequest=new GetXmlHttpObject();var t2lid=document.myForm.taskID.value;var t2ltitle=document.myForm.taskTitle.value;……….. So if the formid varies from form to form how do I solve this in the javascript function: document.??.taskID.value I tried the following but it doesn’t work as intended: function submitFormWithAjax(formid){ var myAjaxPostrequest=new GetXmlHttpObject();var t2lid=document.formid.taskID.value;var t2ltitle=document.formid.taskTitle.value;……….. Can somebody point me in the right direction on how to solve this?Can this be solved by this type of javascript function?
  2. i have tryed to validate this code ( at validator.w3.org) many times and everytime i get this error. can anybody tell me what i have to change to get it to work? 1. Error Line 80 column 14: document type does not allow element "SPAN" here; missing one of "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag. <span id="txt"> </span> The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element. One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>"). <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> bunn </title></head><body onload="startTime()"> <script type="text/javascript"><!--// Get today's current date.var now = new Date();// Array list of days.var days = new Array('Søndag','Mandag','Tirsdag','Onsdag','Torsdag','Fredag','Lørdag');// Array list of months.var months = new Array('Januar','Februar','Mars','April','Mai','Juni','Juli','August','September','Oktober','November','Desember');// Calculate the number of the current day in the week.var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();// Calculate four digit year.function fourdigits(number) { return (number < 1000) ? number + 1900 : number; }// Join it all togethertoday = days[now.getDay()] + " " + date + ". " + months[now.getMonth()] + " " + (fourdigits(now.getYear()));// Print out the datadocument.write("Lokal tid: " +today+ " ");document.write("kl.");// End --></script><script type="text/javascript"> <!-- function startTime() { var today=new Date() var h=today.getHours() var m=today.getMinutes() var s=today.getSeconds() // add a zero in front of numbers<10 var siffer = ""; if( h < 10 ) { siffer = "0" } m=checkTime(m) s=checkTime(s) document.getElementById("txt").innerHTML= siffer + h +":"+m+":"+s t=setTimeout('startTime()',500) } function checkTime(i) { if (i<10) {i="0" + i} return i } //--> </script><span id="txt"> </span></body></html>
  3. littleMe

    Full date

    I have a gap between the date and the clock in this script. how can i get rid of it? Its suppose to be on only one line. Do I have to do this in a CSS document? if so how? And the script only works in IE but not in Mozilla Firefox. What do i have to do to get it to work both places? <html><body><script type="text/javascript">document.write("Local time: ")var d=new Date()var weekday=new Array("Sunday","Monday","Tuesday","Wednsday","Thursday","Friday","Saturday")var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec")document.write(weekday[d.getDay()] + " ")document.write(d.getDate() + ". ")document.write(monthname[d.getMonth()] + " ")document.write(d.getFullYear())</script><script Language="JavaScript"><!-- hide from old browsersfunction jsClock24hr(){var time = new Date()var hour = time.getHours()var minute = time.getMinutes()var second = time.getSeconds()var temp = "" + ((hour < 10) ? "0" : "") + hourtemp += ((minute < 10) ? ":0" : ":") + minutetemp += ((second < 10) ? ":0" : ":") + seconddocument.getElementById('digits').innerText=tempid = setTimeout("jsClock24hr()",1000)}//--></SCRIPT></head><BODY ONLOAD="jsClock24hr()"><FORM NAME="clockForm24hr"><FONT face="Times New Roman,Normal " size=3><span name = f id = digits>Loadings</span></FONT></FORM></body></html>
×
×
  • Create New...