Jump to content

alleyCat

Members
  • Posts

    21
  • Joined

  • Last visited

Posts posted by alleyCat

  1. hi there, I'm developing an AJAX web chat system. I got all the data to the server page, also i'm able to insert data into database. however, i can't display data back to the display screen. Please help~~~~

  2. You can pass html content to an XML file by using POST method. Then you need a seperate server page where xml content is displayed. for example:

    xmlDoc.open("POST","your server page","true");xmlDoc.setRequestHeader("content-type","application/x-www-form-urlencoded");xmlDoc.onreadystatechange=handlesent;var param="media=1";xmlDoc.sent(param);

    Hope this helpsJane

  3. Thank you very much scott100! Your code helps me a lot. However I get an error when I tried to do similar to yours. The error is : Object expected. My code is like this:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Calculator</title><style>input.btn{ color:#050; font-family:'trebuchet ms',helvetica,sans-serif; font-size:small; font-weight:bold; width: 30px; height: 30px;}</style><script type="text/javascript">//real calculator functions//declare two storage place//one for numbers, one for operators//clear screen & storage when user press "C" buttonfunction clear_screen() { document.getElementById("cal_screen").value=""; clear_storage();}function clear_storage() { document.getElementById("storage1").value = ""; document.getElementById("storage2").value = "";}//if the both storage is empty, add cal_screen value and operator to each storage,,,,,,,,,,,,,,//else update the storage1 to be the result of calculation by that operatorfunction add2storage1(op) { if(document.getElementById("storage1").value && document.getElementById("storage2").value) { document.getElementById("storage1").value = parseFloat(document.getElementById("storage1").value) document.getElementById("storage2").value parseFloat(document.getElementById("cal_screen").value); document.getElementById("storage2").value = op; } else { document.getElementById("storage1").value = document.getElementById("cal_screen").value; document.getElementById("storage2").value = op; }}//display number on the screen when user press it,,,,,,,function add2screen(val) { screenval=document.getElementById("cal_screen").value; screenval+=val; document.getElementById("cal_screen").value=screenval;}//calculate result when user press = button,function result() { document.getElementById("cal_screen").value = parseFloat(document.getElementById("storage1").value) document.getElementById("storage2").value parseFloat(document.getElementById("cal_screen").value);}</script></head><body><form name="calculator" action="" method="post" ><table><tr><td><input type = "text" name = "cal_screen" id = "cal_screen" size = "18"/> </td></tr></table><table><tr><td><input type = "button" name = "one" id = "one" value = "1" class = "btn" onClick = "add2screen(this.value)"/></td> <td><input type = "button" name = "two" id = "two" value = "2" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "three" id = "three" value = "3" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "add" id = "add" value = "+" class = "btn" onclick = "add2storage1(this.value)"/></td></tr><tr><td><input type = "button" name = "four" id = "four" value = "4" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "five" id = "five" value = "5" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "six" id = "six" value = "6" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "minus" id = "minus" value = "-" class = "btn" onclick = "add2storage1(this.value)"/></td></tr><tr><td><input type = "button" name = "seven" id = "seven" value = "7" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "eight" id = "eight" value = "8" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "nine" id = "nine" value = "9" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "time" id = "time" value = "x" class = "btn" onclick = "add2storage1(this.value)"/></td></tr><tr><td><input type = "button" name = "zero" id = "zero" value = "0" class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "point" id = "point" value = "." class = "btn" onclick = "add2screen(this.value)"/></td> <td><input type = "button" name = "eq" id = "eq" value = "=" class = "btn" onclick = "result(this.value)"/></td> <td><input type = "button" name = "divide" id = "divide" value = "/" class = "btn" onclick = "add2storage1(this.value)"/></td> <td><input type = "button" name = "clear_screen" id = "clear_screen" value = "C" class = "btn" onclick = "clear_screen()"/></td> <td><input type="hidden" id="storage1" /></td> <td><input type="hidden" id="storage2" /></td></tr></table></form></body></html>

  4. Hi there, could anybody there tell me what are the possible reasons for the error : Object expected, I have created objects to use. part of my code is like this:<form name="calculator" action="" method="post" ><table><tr><td><input type = "text" name = "screen" id = "screen" size = "18"/> </td></tr></table><table><tr><td><input type = "button" name = "one" id = "one" value = "1" class = "btn" onClick = "add2screen(this.value)"/></td></tr></table>it's a javascript calculator, whenever I click on a button, the error message pop up!

  5. Hi everyone! I'm developing a calculator using javascript. I have problem on storing the input field value for later on to refer to. That is when everytime user click on a button, that button's value would be stored in an array, when two values are collected, then perform the calculation depend on the operator been clicked.Could anybody give me idea on this?

×
×
  • Create New...