?
Solved

Getting Javascript to work with my page?

Posted on 2009-02-09
5
Medium Priority
?
237 Views
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;
    }
    //-->
    </script>

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?
0
Comment
Question by:directxBOB
  • 2
  • 2
5 Comments
 
LVL 8

Assisted Solution

by:rseabird
rseabird earned 400 total points
ID: 23589260
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).
0
 
LVL 15

Accepted Solution

by:
Praveen Venu earned 1600 total points
ID: 23589269
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

icustomers.Attributes.Add("onload","adjusticustomers();")
0
 

Author Comment

by:directxBOB
ID: 23589574
I'm getting an error message (javascript side) which is saying the icustomers is undefined.

I am using IE7
0
 
LVL 15

Expert Comment

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


0
 

Author Comment

by:directxBOB
ID: 23589745
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

icustomers.Attributes.Add("onload","adjusticustomers();")

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month16 days, 21 hours left to enroll

864 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