|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
General - Question - Input print button on web page.
Hello. I hope somebody out there can help me. I am a complete novice to asp. I am currently doing a uni project and createing a website for a dance studion in .aspx and I would like a print button so that members can print the timetable off. I have tried the code below but no joy. Can anybody please send me some script through so I can hopefully embed into my site.
THANK YOU. [<script language="JavaScript"> var gAutoPrint = true; // Tells whether to automatically call the print function function printSpecial() { if (document.getElementById != null) { var html = '<HTML>\n<HEAD>\n'; if (document.getElementsByTagName != null) { var headTags = document.getElementsByTagName("head"); if (headTags.length > 0) html += headTags[0].innerHTML; } html += '\n</HE>\n<BODY>\n'; var printReadyElem = document.getElementById("printReady"); if (printReadyElem != null) { html += printReadyElem.innerHTML; } else { alert("Could not find the printReady function"); return; } html += '\n</BO>\n</HT>'; var printWin = window.open("","printSpecial"); printWin.document.open(); printWin.document.write(html); printWin.document.close(); if (gAutoPrint) printWin.print(); } else { alert("The print ready feature is only available if you are using an browser. Please update your browswer."); } } </script> ------------------------------------------------------------------------------- 2. Put This Part In the BODY of Your Page. You need to put the part of the page you want to have printed inside this code. Start copying this part here: <div id="printReady"> This text here is inside the div code so when you click on the button this is what will print. The other text above will not. This way you will be able to put into your Web pages what you think your readers will want to print and leave out what you think they won't want to print. </div> 3. Here are two ways you can place the link on your page for people to click on so they can print the page. This is the text: <a href="javascript:void(printSpecial())">Print this Page</a> Here is the button: <form id="printMe" name="printMe"> <input type="button" name="printMe" onClick="printSpecial()" value="Print this Page"> </form> ] |
|
#2
|
||||
|
||||
|
-->Thread moved to HTML, Javascript, etc. forum.
As the code posted is strictly HTML/Javascript and nothing to do with ASP.
__________________
Come JOIN the party!!! Quote of the Month: Trouble: Luck can't last a lifetime unless you die young. Questions to Ponder: Do cemetery workers prefer the graveyard shift? iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm") copyright© 2008 sbenj69 |
|
#3
|
||||
|
||||
|
What exactly do you mean by 'no joy'?
__________________
Wolffy ------------------------ Teaching people to fish. |
|
#4
|
|||
|
|||
|
Hiya, Sorry about the slang. I mean ,I tried but it did not work. Any ideas???
|
|
#5
|
||||
|
||||
|
Quote:
Worked fine for me -- what I meant was, unless you can be specific beyond 'did not work', we can't really help. In what way did it not work? Also, what browser are you using? |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > General - Question - Input print button on web page. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|