Sunday, May 31, 2009

[jQuery] The Assignment of the Return Value of a jQuery Method/Plug-in to a Reference Variable

QUESTION: Please find below three blocks of code and try to answer
the question in all-caps that precedes this code.

CODE DESCRIPTION: The first block of code uses a jQuery method/plug-
in called toDate( ) that I created. This code has been thoroughly
tested in Firefox, Opera, and Safari. It works superbly.

The second and third blocks of code work in tandem and are labeled
unworkable, because I am unable to assign the returned value of the
toDate( ) method/plug-in to the citationDate reference variable. In
an effort to prove that the rest of the code works I have assigned the
Javascript Date( ) object to the citationDate variable instead. It
works.

I have tried a variety of assignment techniques, but have yet to
stumble on the correct one for toDate( ). WHAT IS THE CORRECT METHOD
OF ASSIGNMENT?

NOTE: If you would like to see how the Date( ) object functions, open
to the HTML source document, clear the pop-up menu, pass your cursor
over the Copyright item in the horizontal menubar, and click on the
item labeled Bibliographical Citation.

The behavior of the toDate( ) method/plug-in is visible in the Preface
panel of the HTML source document and appears automatically


KNOWN WORKABLE CONTEXT (HTML Document only)

<script type="text/javascript">
$(document).ready(function() {
$('#today').toDate();
$('#clock').JSClock();
$('#duration').timePassed();
$('body').SVG_RoundiesIntializer();
$().getBrowserInformation();
});
</script>

HTML SOURCE: http://homepage.mac.com/moogoonghwa/Imagine_Prototype/Content/
JS SOURCE: http://homepage.mac.com/moogoonghwa/Imagine_Prototype/JavaScript/jQ_Imagine.js

TENTATIVELY UNWORKABLE CONTEXT (JS Document)

function citationPrompt() {
var pageTitle = document.title;
var citationDate = new Date();
var pageReference = this.location.href;
var citation = new Object();
citation = {pageCitation: 'Hashimori Iwato. 2000. Imagine: Bridging
Japan\'s Historical Gap. ' + pageTitle + ' &lt;' + pageReference +
'&gt; (' + citationDate + ').'};
var temp = {
state0: {
html: citation.pageCitation,
buttons: {Continue: true},
focus: 1,
opacity:0.6,
submit:function(v,m,f){
if(v) {
return true;
}
return false;
}
}
}
$.prompt(temp);
}

JS SOURCE: http://homepage.mac.com/moogoonghwa/Imagine_Prototype/JavaScript/popUpBoxConfiguration.js

TENTATIVELY UNWORKABLE CONTEXT (HTML Document)

<li><a href="javascript:citationPrompt()">Bibliographical Citation</
a></li>

HTML SOURCE: http://homepage.mac.com/moogoonghwa/Imagine_Prototype/Content/

Roddy

No comments: