Jump to content

skaero

Members
  • Posts

    28
  • Joined

  • Last visited

Previous Fields

  • Languages
    html, css, php, mysql

Contact Methods

  • Website URL
    http://
  • ICQ
    0

skaero's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Thanks for all your help its working now!
  2. That is give me the error: getElementById is not defined - box = getElementById (id);
  3. Ok I understand that part now but how would I put that into: for (var b = 1; j <= 4; j++) { id = "b" + j; box = getElementById (id); if (box.checked == true) { var base = box.value; }} var poststr = "base=" + encodeURI( base ) + "&stand=" + encodeURI( document.getElementById("stand").value ) + "&O1=" + encodeURI( document.getElementById("O1").checked ) + "&O2=" + encodeURI( document.getElementById("O2").checked ) + "&O3=" + encodeURI( document.getElementById("O3").checked ) + "&O4=" + encodeURI( document.getElementById("O4").checked ) + "&O5=" + encodeURI( document.getElementById("O5").checked ) + "&O6=" + encodeURI( document.getElementById("O6").checked ) + "&O7=" + encodeURI( document.getElementById("O7").checked ) + "&O8=" + encodeURI( document.getElementById("O8").checked ); makePOSTRequest("post.php", poststr);} To make the radio buttons work?
  4. I think that's what I have now, can you wright an example for me, sorry for being so thick headed.
  5. I have for (var b = 1; j <= 4; j++) { id = "b" + j; box = getElementById (id); if (box.checked == true) { var base = box.value; }} How can I get this into the var poststr?
  6. I think I got that to work I not that good with JS, So how would I get this to work for the radio buttons?
  7. So how would I use a if checked/send value?
  8. Ok that found the error, it was: java script:get(document.getElementById(myform));. myform didn't have any quotation marks around it, I changed it to: java script:get(this); and now it works! This makes it work for one of the scripts I am making now what I want to do is have it so when the form is changes its automatically sends the data. I changed the document to this: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><script type="text/javascript" language="javascript"> var http_request = false; function makePOSTRequest(url, parameters) { http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { // set type accordingly to anticipated content type //http_request.overrideMimeType('text/xml'); http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open('POST', url, true); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Connection", "close"); http_request.send(parameters); } function alertContents() { if (http_request.readyState == 4) { if (http_request.status == 200) { //alert(http_request.responseText); result = http_request.responseText; document.getElementById('myspan').innerHTML = result; } else { alert('There was a problem with the request.'); } } }function get(obj) { var poststr = "base=" + encodeURI( document.getElementById("base").value ) + "&stand=" + encodeURI( document.getElementById("stand").value ) + "&O1=" + encodeURI( document.getElementById("O1").value ) + "&O2=" + encodeURI( document.getElementById("O2").value ) + "&O3=" + encodeURI( document.getElementById("O3").value ) + "&O4=" + encodeURI( document.getElementById("O4").value ) + "&O5=" + encodeURI( document.getElementById("O5").value ) + "&O6=" + encodeURI( document.getElementById("O6").value ) + "&O7=" + encodeURI( document.getElementById("O7").value ) + "&O8=" + encodeURI( document.getElementById("O8").value ); makePOSTRequest("post.php", poststr);}</script></head><body><form onchange="java script:get(this);" name="myform" id="myform"><b>Base</b><br /><input type="radio" id="base" name="base" value="B1"> Base 1<br /><input type="radio" id="base" name="base" value="B2"> Base 2<br /><input type="radio" id="base" name="base" value="B3"> Base 3<br /><input type="radio" id="base" name="base" value="B4"> Base 4<br /><b>Stand</b><br /><input type="radio" id="stand" name="stand" value="S1"> Stand 1<br /><input type="radio" id="stand" name="stand" value="S2"> Stand 2<br /><input type="radio" id="stand" name="stand" value="S3"> Stand 3<br /><input type="radio" id="stand" name="stand" value="S4"> Stand 4<br /><b>Option</b><br /><input type="checkbox" id="O1" name="O1" value="O1"> Option 1<br /><input type="checkbox" id="O2" name="O2" value="O2"> Option 2<br /><input type="checkbox" id="O3" name="O3" value="O3"> Option 3<br /><input type="checkbox" id="O4" name="O4" value="O4"> Option 4<br /><input type="checkbox" id="O5" name="O5" value="O5"> Option 5<br /><input type="checkbox" id="O6" name="O6" value="O6"> Option 6<br /><input type="checkbox" id="O7" name="O7" value="O7"> Option 7<br /><input type="checkbox" id="O8" name="O8" value="O8"> Option 8</form><span name="myspan" id="myspan"></span></body></html> But the only thing it returns is:B1S1O1O2O3O4O5O6O7O8I need it to only show the ones that are selected. Thanks for the help!
  9. It says that "the error was ()" and <html> is not in the output, right now post.php is: <?phpecho $_POST[content];echo $_POST[site];echo $_POST ;?>
  10. Were would I put the alert? Removing the overrideMIMEtype didn't work. I also found out that if you remove <html> at the top it works in Firefox, so would it be some sort of sintact problem?
  11. That didn't work, Firefox said: "There was an problem with the request" It also did work in IE
  12. Sorry I meant that its not working in Firefox, and I can't find anything wrong with the code. Sorry the bad spelling!
  13. I have a Firefox AJAX problem, it works fine in IE, but only IE. I can't fine anything that's not working. I am not good with js so it most likely something simple.Thanks! <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><script type="text/javascript" language="javascript"> var http_request = false; function makePOSTRequest(url, parameters) { http_request = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_request = new XMLHttpRequest(); if (http_request.overrideMimeType) { // set type accordingly to anticipated content type //http_request.overrideMimeType('text/xml'); http_request.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_request) { alert('Cannot create XMLHTTP instance'); return false; } http_request.onreadystatechange = alertContents; http_request.open('POST', url, true); http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Connection", "close"); http_request.send(parameters); } function alertContents() { if (http_request.readyState == 4) { if (http_request.status == 200) { //alert(http_request.responseText); result = http_request.responseText; document.getElementById('myspan').innerHTML = result; } else { alert('There was a problem with the request.'); } } }function get(obj) { var poststr = "content=" + encodeURI( document.getElementById("content").value ) + "&site=" + encodeURI( document.getElementById("site").value ) + "&page=" + encodeURI( document.getElementById("page").value ); makePOSTRequest("post.php", poststr);}</script></head><body><form action="java script:get(document.getElementById(myform));" name="myform" id="myform"> <textarea id="content" name="content" class="editer"> Content </textarea> <input type="hidden" id="site" name="site" value="1" /> <input type="hidden" id="page" name="page" value="1" /><input type="submit" name="button" value="Submit" /></form><span name="myspan" id="myspan"></span></body></html>
  14. Sorry for the long time for the reply been have internet problems. I know this sounds dum but I have no clue about what you are saying I don't know how to "input an ID and access them via ID" it took me over 10 hours to get the other bit of code to work, I never been good with JS, sorry for all the problems!
  15. OK sorry that was from an old copy: here that new code I still can't get it to send anything to the script:JS var xmlHttpfunction showUser(str){ xmlHttp=GetXmlHttpObject()if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return }var url="getuser.php"url=url+"?q="+strurl=url+"&sid="+Math.random()xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true)xmlHttp.send(null)}function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("txtHint").innerHTML=xmlHttp.responseText } }function Nums(base,stand,other){ showUser(base+stand+other)}function numBase(str){ showUser(str)var url="getuser.php"url=url+"?q="+strurl=url+"&sid="+Math.random()xmlHttp.onreadystatechange=stateChanged xmlHttp.open("GET",url,true)xmlHttp.send(null)}function checkAll() { for (var j = 1; j <= 14; j++) { box = eval("document.bulder.O" + j); if (box.checked == true) var op = box.value; } base = eval("document.bulder.base"); if (box.checked == true) var ba = base.value; stand = eval("document.bulder.stand"); if (stand.checked == true) var st = stand.value;var full = "op+ba+st";showUser(full);} File <html><head><script src="selectuser.js"></script></head><body><form name="bulder"><b>Base</b><br /><input type="radio" name="base" value="1" onchange="checkAll()"> Base 1<br /><input type="radio" name="base" value="2" onchange="checkAll()"> Base 2<br /><input type="radio" name="base" value="3" onchange="checkAll()"> Base 3<br /><input type="radio" name="base" value="4" onchange="checkAll()"> Base 4<br /><b>Stand</b><br /><input type="radio" name="stand" value="1" onchange="checkAll()"> Stand 1<br /><input type="radio" name="stand" value="2" onchange="checkAll()"> Stand 2<br /><input type="radio" name="stand" value="3" onchange="checkAll()"> Stand 3<br /><input type="radio" name="stand" value="4" onchange="checkAll()"> Stand 4<br /><b>Option</b><br /><input type="checkbox" name="O1" value="1" onchange="checkAll()"> Option 1<br /><input type="checkbox" name="O2" value="2" onchange="checkAll()"> Option 2<br /><input type="checkbox" name="O3" value="3" onchange="checkAll()"> Option 3<br /><input type="checkbox" name="O4" value="4" onchange="checkAll()"> Option 4<br /><input type="checkbox" name="O5" value="5" onchange="checkAll()"> Option 5<br /><input type="checkbox" name="O6" value="6" onchange="checkAll()"> Option 6<br /><input type="checkbox" name="O7" value="7" onchange="checkAll()"> Option 7<br /><input type="checkbox" name="O8" value="8" onchange="checkAll()"> Option 8</body></html>
×
×
  • Create New...