javascript in aspx file?

J

Joris De Groote

Hi,

I would like to add a javascript to my aspx file so that users can print
that page. I have some javascript for this:

<SCRIPT LANGUAGE="JavaScript">
if (window.print) {
document.write('<form>Click Here To '
+ '<input type=button name=print value="Print" '
+ 'onClick="javascript:window.print()"> This Page!</form>');
}
</script>

(this shows some text and a button wich you can click to print).

However, when I place the code in aspx (on the html part in body), it just
doesn't work? How can I get this to actually work?

Thanks
 
B

Bruno Alexandre

just add a <a> tag

<a href="javascript: window.print();">
<asp:label runat="server" id="myLabel" text="click here to print" />
</a>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top