473,385 Members | 1,720 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Help Jquery: unable to register a ready function


Hello All

I am trying to activate a link using Jquery. Here is my code;

<html>
<head>
<script type="text/javascript" src="../../resources/js/
jquery-1.2.6.js"</script>

<script language="javascript" type="text/javascript">

$(document).ready(function(){ $('.mylink').click(function()
{ $.jPrintArea('#tabularData') }); });

jQuery.jPrintArea=function(el)
{
alert("hello");

var iframe=document.createElement('IFRAME');

var doc=null;

$(iframe).attr('style','position:absolute;width:0p x;height:
0px;left:-500px;top:-500px;');

document.body.appendChild(iframe);

doc=iframe.contentWindow.document;

var links=window.document.getElementsByTagName('link') ;

for(var i=0;i<links.length;i++)
if(links[i].rel.toLowerCase()=='stylesheet')

doc.write('<link type="text/css" rel="stylesheet" href="'+links[i].href
+'"></link>');

doc.write('<div class="'+$(el).attr("class")+'">'+$(el).html()+'</
div>');

doc.close();

iframe.contentWindow.focus();

iframe.contentWindow.print();

alert('Printing...');

//wait(1);

document.body.removeChild(iframe);

}
</script>
</head>
<body>
<div id="tabularData">
<a href="#" class="mylink" name="mylink">Print this Table</a>
</div>
</body>
</html>

When I click on the link I see nothing. I am expecting to see an
alert. Could someone please tell me where
I am going wrong?

Thanks for your help. Sorry I am unable to post the code on a web
site.

Oct 28 '08
53 8301
Conrad Lender wrote:
<snip>
On 2008-11-05 22:27, David Mark wrote:
>>Perhaps so, but where *is* all that pre-written and
tested code?

These discussions always devolve into a demand for
"pre-written and tested" code. To have pre-written
code, you have to have written some code at some time
that is re-usable.

So, to build a nice, dynamic site one has to build up a
collection of tried-and-tested cross-browser functions first.
That is certainly one way of doing it.
Of course, getting to know all the little gotchas will take
years,
No it doesn't. The first thing to learn is how to accurately pin down
the cause and effect relationships behind the "little gotchas". With
enough effort put in, and sufficient critical (and I mean critical)
feed-back, that should not take more than a month of two. After that the
cycle of handling each browser issue encountered is relatively short,
and in practice you only have to handle issues as they arise, and if
done property the first time, once only.
but that's okay, as long as
you don't use a library.
Every other language has its libraries and module archives;
And very few of them have deployment/distribution issues that are
inherit with javascript.
but we're
different. We're building it all ourselves.
Building up your own "collection of tried-and-tested cross-browser
functions" and writing them all yourself are not the same thing.
Because the library writers
are all "incompetent".
<snip>

That is a pity, isn't it. Have you wondered how it could be that the
world could contain competent browser scripters and yet it is the near
novices who set about designing/writing the general purpose libraries?

Richard.

Nov 6 '08 #51
On Nov 5, 5:34*pm, Conrad Lender <crlen...@yahoo.comwrote:
David, I'm not going to continue this discussion with you, until you
decide to skip the insults and at least pretend to be civil. The
constant digs at the "incompetence" of JQuery and its author are also
getting old, and don't need any further comments. But this does:

On 2008-11-05 22:27, David Mark wrote:
Perhaps so, but where *is* all that pre-written and tested code?
These discussions always devolve into a demand for "pre-written and
tested" code. *To have pre-written code, you have to have written
some code at some time that is re-usable.

So, to build a nice, dynamic site one has to build up a collection of
tried-and-tested cross-browser functions first. Of course, getting to
know all the little gotchas will take years, but that's okay, as long as
you don't use a library.
Every other language has its libraries and module archives; but we're
different. We're building it all ourselves. Because the library writers
are all "incompetent".
would very much like to know where to find it.
Didn't we just have this discussion?

If you're hinting at your own library (again), I'll have to reply
(again) that without a Free Software license it's not much use for most
people. If we're following the previous pattern, this is the point where
you get angry with me.
http://peter.michaux.ca/articles/fea...e-of-the-art-b...
(though the CSS seems to be malfunctioning!)

It's not:http://peter.michaux.ca/articles/omg...-is-old-school

Great idea, btw.

* - Conrad
Nov 6 '08 #52
Thomas 'PointedEars' Lahn <Po*********@web.dewrites:
Eric B. Bednarz wrote:
>[...] The only thing that keeps me from considering you and Thomas Lahn
to be jQuery’s most effective – albeit somewhat unintentional –
ambassadors in this NG is having read its source code myself;
accidental readers are unlikely to share this advantage.

That argument is fallacious as it is based on the false assumption that
discussing the shortcomings of a piece of software attracts a majority of
relevant users to exactly that software.
No it isn’t. It is based on the true assumption that name-calling for its
own sake serves no particular purpose other then egotainment (there’s
nothing wrong with that in the context of Usenet, as far as I am
concerned, but it is only amusing for people who are sufficiently
interested in the topic at hand already). It’s not only about what you
say, but how. And if you do not know that how you say something can have
the opposite effect on your environment, well, than I’d think that’s
lack of experience (David Mark has pointed out repeatedly that it is
lack of interest in his environment in his case, so I willingly take his
word on that).

If you like to know, last year I have been looking for convincing
(external) arguments against (the popular) general purpose libraries in
this NG and I couldn’t find any for the target audience. At least, not
in the broad sense, by – more or less – complete thread (‘the community
has spoken, professionally’). Just like in this thread, there’s usually
just Richard, very verbose, very accurate, very professional (which is
to say, sharp, but not ridiculous, and also very lonely at all of that),
and, implicitly, very expensive, or there would be more of the same
quality. And a lot of noise.

Nov 7 '08 #53
David Mark <dm***********@gmail.comwrites:
Eric B. Bednarz <bedn...@fahr-zur-hoelle.orgwrote:
>I *do* have one good thing to say about jQuery: I hate G2 much more.

You hate something I have never heard of more than jQuery.
You could just stop posting until you know better, how about that?
>Not? The only thing that keeps me from considering you and Thomas Lahn

What does he have to do with it?
Sorry to throw you in the same basket. Apparently he isn’t too cheap to
consult a proper nntp server, my mistake, probably.
Do you think he is the only other
member of the group to question the competence of the jQuery project?
Oh no. The valuable information just didn’t originate from either of you.
Perhaps you are reading a different newsgroup?
Now *that* is more interesting in more senses than you could ever
understand. And the answer is certainly yes.

Nov 7 '08 #54

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mikeh3275 | last post by:
I'm new to developing in jQuery, so I'm probably doing this wrong. I'm loading a form into a modal dialog box and I'm trying to assign a click event to the button in the form, but I can't seem to...
1
by: somnamblst | last post by:
This function swaps images between a close & replay GIF. Line 12 has a speed of 1 second specified for the slideDown, but no speed specified for the slideUp so it is defaulting to normal. I tried...
26
by: RobG | last post by:
Do some of the regulars here need to re-think their (sometimes strident) opposition to libraries? Both Microsoft and Nokia have announced support for jQuery. It seems to have gained quite a bit...
0
by: richard12345 | last post by:
Hi Guys I have problem with site I am building. The sidebar with menu and other thinks is overlapping footer. The footer move with the content and but it dos it dos not move with the sidebar. ...
6
by: aaronkmar | last post by:
Trying to get a loading image to spin while the query is loading. I can get the data div to fade in, but I can't seem to figure out how to get the gif while the query is loading. I'm using two...
25
pradeepjain
by: pradeepjain | last post by:
<html> <head> <script src="jquery.js" type="text/javascript"></script> <script src="jquery.rating.js" type="text/javascript" language="javascript"></script> <link...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.