Jump to content

Bassam122

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by Bassam122

  1. hi,first of all i can't understand why you complecate it that much,why you always add the html,head,title, and body tags to str?!!!!you can do what you want in more simple way: for(var rowCount=0;rowCount<rcount;rowCount++){documnet.write("<tr>")for(var culomnCount=0;culomnCount<ccount;culomnCount++){document.write("<td>")if(imageCount == 12)imageCount=1;elseimageCount++;document.write("<img src=\"IMAGENAME\"+imageCount+\">") // you may need to make some changesdocument.write("</td>")}//end rowCount loopdocumnet.write("</tr>")}//end culomnCount loop you may need to change the variable names to match yours and make some changes to <img...> statment.try it.
  2. hi, try:<input type="radio" ....... style= bgcolor:"red">or<input type="radio" ....... style= color:"red">and let me know if it worked plz.
  3. hi,first try to assign the var url the value window.location.href(var url = window.location.href) then try the codew again.
  4. hi all,thx for ur help, i managed to solve this problem by sending month-1 for setFullYear() instead of month.thank you all for your help and concern, but i have another problem,the following code is supposed to make a calender when the user enter his/her birthday but it's not complete just for months that are 31 day,but it does not work correctly except when the user enter a month that its previous month is 30 days,there is a gap in the if statements that are in the switch statement,i couldn't correct it,any help or suggestions,plz?<html><head><title>Web340 Calender</title><script type="text/javascript">function calender(){var myDay = myCalender.day.valuevar myMonth = myCalender.month.valuevar myYear = myCalender.year.valuemyDay = parseInt(myDay)myMonth = parseInt(myMonth)tempMonth = myMonth - 1myYear = parseInt(myYear)var weekday=new Array()weekday[0]="Su"weekday[1]="Mo"weekday[2]="Tu"weekday[3]="We"weekday[4]="Th"weekday[5]="Fr"weekday[6]="Sa"//document.writeln("Today it is " + weekday[d.getDay("12/2/1986")])var myDate=new Date(myYear,myMonth-1,myDay)//myDate.setFullYear(myYear,myMonth,myDay)document.write(weekday[myDate.getDay()]+"</br>")document.write(myDate.getMonth()+"</br>")var tempDate = new Date()tempDate.setFullYear(myYear,myMonth-1,1)var tempDay = tempDate.getDay()document.write(weekday[tempDate.getDay()]+"</br>")document.write(weekday[myDate.getDay()]+"</br>")document.writeln("<table bgcolor=\"#ccffdd\" id=\"calenderTable\" border =\"1\" cellpadding=\"3\" cellspacing=\"3\"><tr>")for(var counter=0; counter<7; counter++) document.writeln("<th>"+weekday[counter]+"</th>")document.writeln("</tr>")/*for(var row=0; row<6; row++){ document.writeln("<tr>") for(var culomn=0; culomn<7; culomn++) { document.writeln("<td>"+(row+culomn)+"</td>") } document.writeln("</tr>")}*/switch(myMonth-1){ case 0 : case 2 : case 4 : case 6 : case 7 : case 9 : case 11 : { var theDay = 1; document.writeln("<tr>") if( ( tempMonth == 6 ) || ( tempMonth == -1) ) for(var counter=tempDay; counter>0; counter--) { document.write("<td bgcolor=#00ffdd>") document.write(31-counter+2); document.write("</td>") window.alert("hi") } else if( tempMonth == 1 ) { if(myYear%4 == 0) for(var counter=tempDay; counter>0; counter--) { document.write("<td bgcolor=#00ffdd>") document.write(31-counter-10) document.write("</td>") window.alert("hi") } else for(var counter=tempDay; counter>0; counter--) { document.write("<td bgcolor=#00ffdd>") document.write(31-counter-2) document.write("</td>") window.alert("hi") } } else { for(var counter=tempDay; counter>0; counter--) { document.write("<td bgcolor=#00ffdd>") document.write(31-counter) document.write("</td>") window.alert("hi") } } for(var counter=tempDay; counter<7; counter++) { if(myDay == theDay) { document.write("<td bgcolor=red>"+theDay+"</td>") theDay++ } else { document.write("<td>"+theDay+"</td>") theDay++ } } document.writeln("</tr>") for(var row=0; row<5; row++) { if(theDay == 32) break document.write("<tr>"); for(var culomn=0; culomn<7; culomn++) { if(myDay == theDay) { document.write("<td bgcolor=red>"+theDay+"</td>") theDay++ } else { document.write("<td>"+theDay+"</td>") theDay++ } if(theDay == 32) break } document.write("</tr>") } }//end case 0,2,4,6,7,9,11 }//end swithcdocument.writeln("</table>")}</script></head><body><center><h1 style=color:#985631>Simple Calender</h1><hr><form id="myCalender"><h3>Enter you date of birth, please: </h3><label><b>Day: </b></label><input type="text" id="day" size=1><label><b> &nbspMonth: </b></label><input type="text" id="month" size=1><label><b> &nbspYear: </b></label><input type="text" id="year" size=1><br><br><input type="button" onclick="calender()" value=" go " size="50"></input></form></center></body></html>
  5. hi, idon't know why my Date object give me worng results,this is a simple code i wrote and it gives me wrong result despite it looks very simple amd error free,plz help.<html><head><title>Web340 Calender</title><script type="text/javascript">function calender(){var myDay = myCalender.day.valuevar myMonth = myCalender.month.valuevar myYear = myCalender.year.valuemyDay = parseInt(myDay)myMonth = parseInt(myMonth)myYear = parseInt(myYear)var weekday=new Array()weekday[0]="Su"weekday[1]="Mo"weekday[2]="Tu"weekday[3]="We"weekday[4]="Th"weekday[5]="Fr"weekday[6]="Sa"//document.writeln("Today it is " + weekday[d.getDay("12/2/1986")])var myDate=new Date()myDate.setFullYear(myYear,myMonth,myDay)document.write(weekday[myDate.getDay()]+"</br>")document.write(myDate.getMonth()+"</br>")var tempDate = new Date()tempDate.setFullYear(myYear,myMonth,1)var tempDay = tempDate.getDay()document.write(weekday[tempDate.getDay()]+"</br>")document.write(weekday[myDate.getDay()]+"</br>")</script></head><body></body></html>
×
×
  • Create New...