From: jr on 1 Aug 2010 00:04 I want the AJAX printFromHere() script to fire when the user clicks the 'print the current page' button. It doesn't fire now? I don't know if I need another event besides onClick? This is what I have in the form but it doesn't work. I would really like it if the xmlhttp response text came back in the printer response div. I enclose the View Source with the print this button at the close of this post. I have enclosed the view source with the javascript function printFromHere. The button "print this page" input with the call to the function is the very last line. I would also like to know how to get the xmlhttp response to return to the div id='response_text' below that button input. thanks, <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" <html> <head> <title>Print Barcode Labels</title> <script type="text/javascript"> function printFromHere(){ var xhr = document.forms[0].search_zonenm.value; if ( window.XMLHttpRequest ) {// code for IE7+, Firefox, Chrome, Opera, Safari xhr=new XMLHttpRequest(); }else{ // code for IE6, IE5 xhr=new ActiveXObject("Microsoft.XMLHTTP"); } xhr.onreadystatechange = function() { if(xhr.readyState == 4) { if(xhr.status == 200) document.getElementById.printer_response="Received:" + xhr.responseText; else document.getElementById.printer_response ="Error code " + xhr.status; } } xhr.open(GET, "print_test.php", true); xhr.send(null); } </script> </head> <body> <h2 align='center'>Print Bar Code Labels</h2> <form action='/tools/XXXXX/print_labels_form5.php' onsubmit1='return checkscript();' method='post'><a href='admin.php'>Admin Menu<a/><br> PAGE: 350<table align='center' style='border:1px solid ;'> <tr><th align='right'>BU</th> </tr><tr><td><select name='search_bu'id='search_bu'onChange='fillZoneNm();'> <option value=''>Select BU</option> <option value='08132' SELECTED>081</option> <option value='08136' >082</option> </select> </td></tr><tr> <th align='right'>Zone Number</th> <td><div id='search_zonenm'> <select name='search_zonenm' id='search_zonenm'> <option value=''>Select Zone Number</option> <option value='BIRTH CONTROL' >BIRTH CONTROL</option> <option value='CIIIS' >CIIIS</option> </select> </td></tr><tr> <th align='right'>Zone ID</th> <td><input type'text' name='search_zoneid' id='search_zoneid' size='9' class='txt1'></td> </tr> <tr><td colspan='13' align='center'><input type='submit' name='submit1' value='Search'></td> </tr></table> No of Records: 1746 <th>Location <th>Zone<br /> Number <th>Zone<br /> ID <th>NDC <th>Item ID <th>Description <th>UPCK <th>NDC<br />UOM </tr> <tr><tr class='gry'> <td style='border:solid black 1px;padding:5px;'>08132 <td style='border:solid black 1px;padding:5px;'>Downey <td style='border:solid black 1px;padding:5px;'>SYRINGES <td style='border:solid black 1px;padding:5px;'>0221 <td style='border:solid black 1px;padding:5px;'>00193288021 <td style='border:solid black 1px;padding:5px;'>00193288021 <td style='border:solid black 1px;padding:5px;'>KETOSTIX REAGENT NFRS STRIP 100/BX <td style='border:solid black 1px;padding:5px;'> <td style='border:solid black 1px;padding:5px;'>BX </tr> </table> <table><tr><td>No Pages: 350 <br /><a href='/tools/cart_inventory/ print_labels_form5.php?page=1&bu=08132&zonenm=&zoneid='>1</a> <a href='/tools/XXXX/print_labels_form5.php? page=2&bu=08132&zonenm=&zoneid='>2</a> <a href='/tools/XXXXX/print_labels_form5.php? page=3&bu=08132&zonenm=&zoneid='>3</a> <a href='/tools/XXXXX/print_labels_form5.php? page=4&bu=08132&zonenm=&zoneid='>4</a> <a </td></tr></table><table><tr><td><div id='printbutton'><input type="button" name="print" value="Print this page" id='printbutton' onClick="printFromHere();"/></div></td></tr><tr><td><div id='printer_response'></form></div></td></tr></table></form></body> </html>
From: Denis McMahon on 1 Aug 2010 05:12 On 01/08/10 05:04, jr wrote: > <script type="text/javascript"> > function printFromHere(){ > > var xhr = document.forms[0].search_zonenm.value; > if ( window.XMLHttpRequest ) {// code for IE7+, > Firefox, Chrome, Opera, Safari > xhr=new XMLHttpRequest(); > }else{ // code for IE6, IE5 > xhr=new ActiveXObject("Microsoft.XMLHTTP"); > } What is the purpose of xhr in your code? Is it to hold the XMLHttpRequest object, or to hold the value of field document.forms[0].search_zonenm.value? See my earlier response to the original thread about this code for other issues. Rgds Denis McMahon
From: David Mark on 1 Aug 2010 05:34 On Aug 1, 12:04 am, jr <jlro...(a)yahoo.com> wrote: > I want the AJAX printFromHere() script to fire when the user clicks > the > 'print the current page' button. If you can't do that, you are getting way ahead of yourself with Ajax. > It doesn't fire now? Doesn't it? > I don't know if I need another event besides > onClick? This is what I'm talking about. > This is what I have in the form but it doesn't work. http://www.jibbering.com/faq/notes/posting/#ps1DontWork > I would really like it if the xmlhttp response text came back in the > printer response div. People in hell want ice water. This is not a help desk. > I enclose the View Source with the print this > button at the close of this post. > I have enclosed the view source with the javascript function > printFromHere. Well, that's good of you. > The button "print this page" input with the call to > the function > is the very last line. > > I would also like to know how to get the xmlhttp response to return to > the div id='response_text' below that button input. > thanks, > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" Why are you using XHTML when IE doesn't support it? Clearly you are relying on error correction to turn it into HTML. That's not a sound strategy (despite its inexplicable popularity). Also, what are you transitioning from? And why are you transitioning to a language that died on the Web almost a decade ago? > <html> > <head> > <title>Print Barcode Labels</title> > <script type="text/javascript"> > function printFromHere(){ > > var xhr = document.forms[0].search_zonenm.value; Never do that. Use the - elements - property of the form object. > if ( window.XMLHttpRequest ) {// code for IE7+, > Firefox, Chrome, Opera, Safari > xhr=new XMLHttpRequest(); > }else{ // code for IE6, IE5 > xhr=new ActiveXObject("Microsoft.XMLHTTP"); > } Object inference. It should be clear from the comments that this is another form of browser sniffing. Don't write scripts based on observing a handful of today's browsers, else you'll be rewriting them in perpetuity (see jQuery, Dojo, YUI, Ext JS, etc.) http://www.jibbering.com/faq/notes/detect-browser/#bdOI > xhr.onreadystatechange = function() > { > if(xhr.readyState == 4) > { > if(xhr.status == 200) > > document.getElementById.printer_response="Received:" + > xhr.responseText; Well, this might just be your lucky day as I sure as hell wasn't going to wade through the whole thing. What's wrong with that picture? You are clearly just rearranging patterns here. Where have you seen such a pattern? I suppose now that the likely suspect has been pointed out, perhaps some enabler will come along and gift-wrap the answer. I hope not as this is how library authors are born. :(
From: Thomas 'PointedEars' Lahn on 1 Aug 2010 06:15 David Mark wrote: > jr wrote: >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > > Why are you using XHTML when IE doesn't support it? Clearly you are > relying on error correction to turn it into HTML. That assumption cannot be made from the posting. > That's not a sound strategy (despite its inexplicable popularity). Non sequitur. > Also, what are you transitioning from? Since XHTML 1.0 is "a reformulation of HTML 4 in XML 1.0"¹, XHTML 1.0 Transitional (instead of Strict) needs to be declared if one wants to declare and use XHTML, and use features that were (prematurely) deprecated by HTML 4.01, such as the `target' attribute and the `iframe' element. > And why are you transitioning to a language that died on the Web almost a > decade ago? I wished people would stop perpetuating this legend. That many people do not know how to use XHTML properly or do not know about the advantages that XHTML can provide does not make the language dead.² PointedEars ___________ ¹ <http://www.w3.org/TR/xhtml1/> ² <news:1597428.G923GbCHz0(a)PointedEars.de> <news:1997532.qChMirdbgy(a)PointedEars.de> -- var bugRiddenCrashPronePieceOfJunk = ( navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac') != -1 ) // Plone, register_function.js:16
From: David Mark on 1 Aug 2010 07:52 On Aug 1, 6:15 am, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> wrote: > David Mark wrote: > > jr wrote: > >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" > >> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > > > Why are you using XHTML when IE doesn't support it? Clearly you are > > relying on error correction to turn it into HTML. > > That assumption cannot be made from the posting. LOL. You really think this "jr" guy is using XML parse mode? Furthermore, on the entire Web, I know of exactly one document that creates an XHTML DOM. My XHTML Build Test page. Again, what would be the point as IE (< 9) anyway does not support it. It's been a dead issue almost from the start on the Web. Not only that, but you are flat-out wrong about the context of this posting. The posted markup is not going to work in XML parse mode. > > > That's not a sound strategy (despite its inexplicable popularity). > > Non sequitur. Non-sense. > > > Also, what are you transitioning from? > > Since XHTML 1.0 is "a reformulation of HTML 4 in XML 1.0"¹, XHTML 1.0 > Transitional (instead of Strict) needs to be declared if one wants to > declare and use XHTML, and use features that were (prematurely) deprecated > by HTML 4.01, such as the `target' attribute and the `iframe' element. No kidding. But see above. > > > And why are you transitioning to a language that died on the Web almost a > > decade ago? > > I wished people would stop perpetuating this legend. And how many sites on the Web do you know of that use XML parse mode? > That many people do > not know how to use XHTML properly or do not know about the advantages that > XHTML can provide does not make the language dead.² It's a stiff. Bereft of life, it rests in peace. :) And please stop confusing the newcomers.
|
Next
|
Last
Pages: 1 2 3 4 5 Prev: how to send XMLHTTP object from a button input Next: ANUSHKA HOT PICTURES |