Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1045479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:59:28+00:00 2026-05-16T15:59:28+00:00

I have an inline script on my page as such: <script type=text/javascript> var rootPath

  • 0

I have an inline script on my page as such:

<script type="text/javascript">
    var rootPath = '<%= Url.Content("~/") %>';

    $(document).ready(function () {

        $('#logonStatus').click(function () { loadLoginForm(); });
        alert('Document Ready');
    });

    function loadLoginForm() {

        if(!serenity.tools.isStyleSheetLoaded('redmond.css')) {
            $('head').append('<%= Url.StyleTag("Redmond/redmond.css", MediaTypes.Screen) %>');
        }            

        if(!serenity.tools.elementExists($('#logonContainer'))) {
            $.ajax({
                async: false,
                cache: false,
                datatype: 'html',
                success: function (data) { $('body').append(data); },
                type: 'GET',
                url: '/Membership/LogOn'
            });
        }

        $('#logonContainer').dialog({
            modal: true,                
            hide: 'slide'
        });
    }


</script>

I also am loading a custom javascript file and the contents of it are as such:

var serenity = new function () {

$(document).ready(function () {

    jQuery.ajaxSetup({
        beforeSend: function (xhr) {
            xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        }
    });

});

this.tools = new function () {

    this.isStyleSheetLoaded = function (fileName) {

        $(document.styleSheets).each(function () {
            if (this.href.toLowerCase().indexOf(fileName) != -1) {
                this.isStyleSheetLoaded = true;
                return;
            }
        });

        this.isStyleSheetLoaded = false;
    }

    this.elementExists = function (element) {
        this.elementExists = element.length != 0;
    }
}

}

The file that is being loaded by the ajax call is simply a div with an table containing input elements. The file does not contain any javascript in it whatsoever.

My problem is that the first time I call isStyleSheetLoaded it works just fine but after the file is loaded and the dialog is shown and closed I click on the link that fires the loadLoginForm function but this time it says isStyleSheetLoaded is not a function. This is showing up in all browsers, so I am 99% sure it is my problem, but I have no idea what it is. Could someone please point me in the right direction?

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:59:29+00:00Added an answer on May 16, 2026 at 3:59 pm

    I think your problem is the following:

    you define a function “this.isStyleSheetLoaded = function (fileName)” but in his body you overwride this property “this.isStyleSheetLoaded = true;”.

    So after your first call of isStyleSheetLoaded the function is overwride with a boolen.

    the right way could be:

        this.isStyleSheetLoaded = function (fileName) {
    
          $(document.styleSheets).each(function () {
            if (this.href.toLowerCase().indexOf(fileName) != -1) {
                return true;
            }
          });
    
        return false;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery stat does something when the page loads: $(document).ready(function(){ tb_show('#TB_inline?height=490&width=534&inlineId=compare', false);
Here's my code: <!doctype html> <html> <head> <script type=text/javascript src=http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js></script> <style type=text/css> label {display:block;
I have the following inline Javascript code: <a href=javascript:{ document['example'].src = 'cube.png'; document.getElementById('constructor').innerHTML =
For even a simple block of inline JavaScript in an HTML page, such as:
I have an inline member function defined under class MyClass int MyClass::myInlineFunction(); This function
I have the following function: inline auto iterateSomething(obj & o) { auto iterators =
I have this code: if (Page.IsPostBack) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), Javascript, alert('test');jQuery('html, body').animate({ scrollTop: jQuery('.newslettersubscribe').position().top },
Assume, for whatever reason, that we have three inline scripts on a page. Each
So I've got an XHTML page with a script - not inline > <script
I have a resources web app, which only has static content, such as images,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.