|
| Index | Recent Threads | Unanswered Threads | Who's Online | User List | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 9
|
|
| Author |
|
|
Advanced Member USA Joined: Mar 24, 2005 Post Count: 3000 Status: Offline |
Hi All! Thanks to davidmead, I've been using js to open new windows using rel="external" in the <a></a> tag instead of target="_blank" The script is: function externalLinks() { if (!document.getElementsByTagName) return; var anchors = document.getElementsByTagName("a"); for (var i=0; i<anchors.length; i++) { var anchor = anchors; if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank"; } } window.onload = externalLinks; Name it newwindow.js or something; call it from the header <script type="text/javascript" src="newwindow.js"></script> and trigger it from a link; <a href="something.html" title="something" rel="external">some link</a> Easy as pie. So, I'm trying find the same for a javascript print function. I'd like to be able to the following: <a href="#" title="something" rel="print">Print this page</a> instead of doing this: <a href="#" onClick="window.print(); return false" title="Print this page">Print this page</a> I haven't found anything on the Internet yet and my attempts to mess around with the script above have failed. TIA for any suggestions! - ---------------------------------------- "The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo Save the developers<!> Maine Webworks ---------------------------------------- [Edit 2 times, last edit by shelfimage at Nov 1, 2005 11:37:01 AM] |
||
|
|
Advanced Member USA Joined: Nov 27, 2003 Post Count: 6285 Status: Offline |
Would it not be just as effective to create a Print style sheet ot remove all eye candy and allow th erson to use the print command of the browser? Maybe I can find something on it at accessify. |
||
|
|
Advanced Member USA Joined: Mar 24, 2005 Post Count: 3000 Status: Offline |
Would it not be just as effective to create a Print style sheet ot remove all eye candy and allow th erson to use the print command of the browser? I've done that. I have a print.css but, my specs call for a .js print function and the graphic designer has a Print this page graphic. The page is here: index2.html in the source code it is commented <!-- Print and Email functions --> I did a bit against spec though: css roll-over for the images instead of js roll-over - haha And, the page doesn't validate as 1.0 trans or strict with the onclick="" attribute .... -tia ---------------------------------------- "The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo Save the developers<!> Maine Webworks ---------------------------------------- [Edit 1 times, last edit by shelfimage at Nov 1, 2005 12:00:13 PM] |
||
|
|
Advanced Member UK Joined: Dec 29, 2004 Post Count: 1662 Status: Offline |
And, the page doesn't validate as 1.0 trans or strict with the onclick="" attribute .... Make sure onclick is all lowercase. ---------------------------------------- Pavonis Mons | Listen of the week: "Residue of Desire" by Acumen |
||
|
|
Advanced Member USA Joined: Mar 24, 2005 Post Count: 3000 Status: Offline |
And, the page doesn't validate as 1.0 trans or strict with the onclick="" attribute .... Make sure onclick is all lowercase. I didn't even notice I had it as onClick="" Thank-You!!!! I guess I don't need a different script afterall. It would be neat to have - I think xhthml 1.1 says no .js inline - but I'm not sure if that's in the tag or the header unless it's escaped properly. - ---------------------------------------- "The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo Save the developers<!> Maine Webworks |
||
|
|
Advanced Member USA Joined: Nov 27, 2003 Post Count: 6285 Status: Offline |
Just the usual side note... have you tested if the onclick() works using the keypad for navigation? Not everyone uses a mouse... ![]() |
||
|
|
Advanced Member USA Joined: Mar 24, 2005 Post Count: 3000 Status: Offline |
Just the usual side note... have you tested if the onclick() works using the keypad for navigation? Not everyone uses a mouse... ![]() No I didn't. But, amazingly it works in both ff and ie. Of course I have to tab through about dozen links before I get there. You should see the fangs output. It's ugly. [ugh]How do you help a graphic designer understand accessiblity and SEO to design templates better?[/ugh] ---------------------------------------- "The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo Save the developers<!> Maine Webworks |
||
|
|
Advanced Member UK Joined: Dec 29, 2004 Post Count: 1662 Status: Offline |
I guess I don't need a different script afterall. It would be neat to have - I think xhthml 1.1 says no .js inline - but I'm not sure if that's in the tag or the header unless it's escaped properly. I think I've read somewhere that JS events are still accepted in tags, otherwise, how else would you do it? Got me worried now. ![]() ---------------------------------------- Pavonis Mons | Listen of the week: "Residue of Desire" by Acumen |
||
|
|
Advanced Member USA Joined: Nov 27, 2003 Post Count: 6285 Status: Offline |
[ugh]How do you help a graphic designer understand accessiblity and SEO to design templates better?[/ugh] By asking you all sorts of irritating questions if you tested something or not It takes practice and common sense. I was buggered at Accessify for a good year and then one day all the peices began comming together and I began to think accessibility. Just have to read alot. Once stateside I intend to find some local organizations for the blind etc. and hang out with them, maybe get them to test for me. |
||
|
|
|
|
|
Current timezone is GMT May 23, 2013 10:20:24 PM |