J
jr
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>
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>