Tony,

The error says it all.  'question' is not defined.  It looks like you
removed this line:

var question = $('#question')[0];

This line should execute one time, in a doc-ready block.  It is just a
quick way to cache the element so that you can use it over and over,
even if it is removed from the DOM.

Mike

On 7/20/07, Anthony Leboeuf(Worcester Wide Web)
<[EMAIL PROTECTED]> wrote:

anyone have any idea? im really stumped on this one. hours and still
cant figure out the deal in firefox

Anthony Leboeuf(Worcester Wide Web) wrote:
>
> The error is right, question is not defined. Is there a way to bipass
> it looking for that variable in firefox?
>
> works perfect in IE
> -Tony
>
>
> function addtocart(formName,product) {
>   var obj = findObj(formName);
>   if (obj != null) {
>         $.blockUI(question, { width: '275px' });
>
>       $('#cart').click(function() {
>           obj.submit();
>            window.location = "/order/cart.php?act=cart";
>                           });
>       $('#stay').click(function() {
>           $.unblockUI();
>           obj.submit();
>       });
>   }
>   else {
>     alert('The form you are attempting to submit called \'' + formName
> + '\' couldn\'t be found. Please make sure the submitDoc function has
> the correct id and name.');
>   }
> }
>   Anthony Leboeuf(Worcester Wide Web) wrote:
>>
>> Hey I just noticed,
>>
>> It doesnt work in firefox, it says question is not defined which
>> wierd because question is not a function?
>> http://pioneer.dlg360.com/order/index.php?act=viewProd&productId=2641
>>
>>
>> question is not defined
>> $.blockUI(question, { width: '275px' });
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> Anthony Leboeuf(Worcester Wide Web) wrote:
>>>
>>> Excellent,
>>> Thanks for the info, Im reading up on it right now
>>>
>>> -Tony
>>>
>>> Mike Alsup wrote:
>>>>
>>>> Anthony,
>>>>
>>>> The doc-ready construct provides a place to put code that needs to
>>>> *execute* after the DOM has fully loaded.  For example, this line:
>>>>
>>>> var question = $('#question')[0];
>>>>
>>>> should be in a doc-ready block because you want to ensure the element
>>>> is available before you select it.  But your "addtocart" function is
>>>> called in response to an click event handler, so the code within it
>>>> does not need to be wrapped in a doc-ready block.
>>>>
>>>> For more on the "ready" method:
>>>>
>>>> http://docs.jquery.com/Tutorials:Introducing_%24%28document%29.ready%28%29
>>>>
>>>> http://docs.jquery.com/Events#ready.28_fn_.29
>>>>
>>>> Mike
>>>>
>>>>
>>>> On 7/20/07, Anthony Leboeuf(Worcester Wide Web)
>>>> <[EMAIL PROTECTED]> wrote:
>>>>>
>>>>> Hi Mike,
>>>>>
>>>>> Thanks allot that worked great! now to help out a nooby here this is
>>>>> considered DOM right? and in DOM you dont need doc ready functions ?
>>>>>
>>>>> Thanks again
>>>>>
>>>>> -Anthony
>>>>>
>>>>> Mike Alsup wrote:
>>>>> >
>>>>> > Anthony,
>>>>> > You've got script errors on that page.   You need to get those
>>>>> cleared
>>>>> > up first.  Also, your blockUI code doesn't need to be in a
>>>>> doc-ready
>>>>> > block (ie: $(function(){})) since you're calling it from an event
>>>>> > handler.  Try something like this:
>>>>> >
>>>>> > var question = $('#question')[0];
>>>>> >
>>>>> > function addtocart(formName,product) {
>>>>> >    var obj = findObj(formName);
>>>>> >    if (obj != null) {
>>>>> >        $.blockUI(question, { width: '275px' });
>>>>> >
>>>>> >        $('#yes').click(function() {
>>>>> >            obj.submit();
>>>>> >             window.location = "/order/cart.php?act=cart";
>>>>> >            return false;
>>>>> >        });
>>>>> >        $('#no').click(function() {
>>>>> >            $.unblockUI();
>>>>> >            obj.submit();
>>>>> >        });
>>>>> >    }
>>>>> >    else {
>>>>> >        alert('warning');
>>>>> >    }
>>>>> > }
>>>>> >
>>>>> > Mike
>>>>> >
>>>>> >
>>>>> > On 7/19/07, Anthony Leboeuf(Worcester Wide Web)
>>>>> > <[EMAIL PROTECTED]> wrote:
>>>>> >>
>>>>> >>  Hello everyone, Im having a bit of trouble using blockui. I've
>>>>> added
>>>>> >> the
>>>>> >> plugin here
>>>>> >>
>>>>> http://pioneer.dlg360.com/order/index.php?act=viewProd&productId=2678
>>>>> >> when you click "add to basket" it should ask you a
>>>>> question(instead
>>>>> >> it asks
>>>>> >> the question for 2 seconds then submits). But for some reason its
>>>>> >> forcing
>>>>> >> the submit instead of waiting for the answer as the blockui demo
>>>>> >> shows. I
>>>>> >> just cant seem to fix it, anyone have any suggestions? here is
>>>>> my code
>>>>> >> http://pastebin.mozilla.org/157254
>>>>> >>
>>>>> >>  Thanks any help is appreciated
>>>>> >>
>>>>> >>
>>>>> >>  -Anthony
>>>>> >>
>>>>> >
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>>
>
>


Reply via email to