Getting Javascript to work with my page?

Posted on 2009-02-09
Last Modified: 2012-05-06
I have an ASP.NET Page

I have placed the following script in my head:

  <script type="text/javascript">
    function getElement(aID)
        return (document.getElementById) ?
            document.getElementById(aID) : document.all[aID];

    function getIFrameDocument(aID){
        var rv = null;
        var frame=getElement(aID);
        // if contentDocument exists, W3C compliant (e.g. Mozilla)

        if (frame.contentDocument)
            rv = frame.contentDocument;
        else // bad IE  ;)

            rv = document.frames[aID].document;
        return rv;

    function adjusticustomers()
        var frame = getElement("icustomers");
        var frameDoc = getIFrameDocument("icustomers");
        frame.height = frameDoc.body.offsetHeight;

and then within my page:

<iframe id="icustomers" onload='adjusticustomers();' runat="server" src="..."> </iframe>

But I am getting the following error:

Creator.master(85,0): error BC30456: 'adjusticustomers' is not a member of 'ASP.creator_master'.
Creator.master(85,0): error BC30037: Character is not valid.

Any ideas on how I resolve this?
Question by:directxBOB
    LVL 8

    Assisted Solution

    You put 'runat="server" inside the ifram tag. I suppose that will not work. It should be either client side (use the javascript) or server side (use .net code).
    LVL 15

    Accepted Solution

    Since you have made it run at server it will consider onload as server side function.

    Instead of that make it like

    <iframe id="icustomers" runat="server" src="..."> </iframe>

    and in the Page_Load on the server side


    Author Comment

    I'm getting an error message (javascript side) which is saying the icustomers is undefined.

    I am using IE7
    LVL 15

    Expert Comment

    by:Praveen Venu
    So it means your code not able to get the icustomers frame


    Author Comment

    Anyway to figure out why? All pages are contained within the same directory. As you can see my ID for the page

    <iframe id="icustomers" onload='adjusticustomers();' runat="server" src="..."> </iframe>

    does match up with


    So i am wondering what the potential reasons for the JavaScript not working might be.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now