473,804 Members | 3,478 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object for iframe not being created

3 New Member
Hi Experts,
I am trying this bit of code which is not working right.

<script language="JavaS cript" type="text/JavaScript">
<!--
function showHide(divNam e)
{
var x = new getObj(divName) ;
document.writel n(x.name);
//document.writel n(x.value);
}
//-->
</script>
__________
document.getEle mentById("statu sUpdate").inner HTML += "<input type='checkbox' id = 'demogexcel' name='demogexce l' value='DEMOG' onClick='showHi de(\"demog\")'> &nbspYes/ No </td> ";

document.getEle mentById("statu sUpdate").inner HTML += "</tr><tr width='100%'><t d width='100%' colspan='4' valign='middle' class='verdanab lue'>";

document.getEle mentById("statu sUpdate").inner HTML += "<iframe id=\"demog\" name=\"demog\" display='none' width='100%;' height='100px' border= '0px' bgcolor='e6e8ed ' scrolling='yes' FRAMEBORDER=0 ></iframe></td>";

document.getEle mentById("statu sUpdate").inner HTML += "</tr></table>";

Here, when the checkbox created innerHtml named demogexcel is clicked, the showHide function is called. I have also confirmed that demog value is passed to it correctly. However the line var x = new getObj(divName) ; does not create an object for the iframe - demog. Please can anybody help me with this.
I have also tried putting the name of the iframe in singlequotes.

I have tried the similar thing in another asp and it works perfectly fine, but in that case the iframe is created simple in a table and not in innerhtml of any object.

Is there any other alternative to doing this?

Thanks,
K
Jul 13 '07 #1
5 1628
gits
5,390 Recognized Expert Moderator Expert
hi ...

you have the getObj-method because you are using dreamweaver? what error occurs in firefox's or mozillas js-console? ...

kind regards
Jul 13 '07 #2
Ketty
3 New Member
Hi,
I am testing this code in IE 6.0 and the code does not give any error
The basic functionaltiy that I want to achieve is
1. Ask the user if he wants to upload an excel spreadsheet with the 'demogexcel checkbox'.
2. If the user checks the checkbox, I have written the code to upload the excel in another asp page which I want to display in the 'iframe demog'
3. I also tried the following - in showhide(divNam e) funtion and it works fine.

var x = new getObj("demog") ;
alert(x.obj.id) ; // displays the id of the iframe correctly.

But the below 2 lines dont work but also do not give any error
x.style.display = "";
x.src="www.goog le.com";

Am I doing something wrong??
The same thing works fine in another asp where the iframe object is created normally and not in the innerHTML code.
Hope I have explained my problem well.

Thanks!
Jul 13 '07 #3
gits
5,390 Recognized Expert Moderator Expert
do you see the iframe? in case you don't see it ... perhaps you pm me the generated html-page and i'll have a look about it ... when it's not too much code you may post it here instead ... may be there is something wrong with the dom that you create with innerHTML?

kind regards
Jul 13 '07 #4
Ketty
3 New Member
Hi Gits,

Yes, I do see the iframe.
The showHide(divNam e) function is also called properly with iframe value demog.
Infact when I tried
var x = new getObj(divName) ;
alert(x.obj.id) ; // this line displays the id of the iframe correctly.
But
x.src="www.goog le.com"; // this line does not give any error but does not execute properly.

How can I send you the entire code, if possible. Its too big to paste it here.

Thanks,
K
Jul 16 '07 #5
gits
5,390 Recognized Expert Moderator Expert
hi ...

as far as i can see from the code you sent to me it works like the following (i do it with pseudocode ... its really a lot of code otherwise ;) ):

Expand|Select|Wrap|Line Numbers
  1. <script>
  2.     // here are some scripts defined the following method too
  3.     function showHide(divName) {
  4.         // do something
  5.     }
  6. </script>
  7. <body>
  8.     <script>
  9.         // the problem is here !!! when you use document.getElementById();
  10.         // this will be executed during load where the dom is not really 
  11.         // (reliable) ready yet so the solution is to put it in a function in your 
  12.         // above script-area and call that function with onload of the body 
  13.     </script>
  14. </body>
  15.  
read the comments in the above pseudocode ... i think you will understand the problem and the solution ;) and i discovered that 'demog' is a duplicate id for a table and your iframe ... when making it unique ... it worked for me ... so:

first: make the id unique
second: try to put all js-operations with getElementBy... () in onload

kind regards
Jul 19 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
10172
by: John Chen | last post by:
I need to use iframe to create a floating frame. But the contents in the iframe is not a external html file. Rather, it will be dynamically created by jsp. How can I set the src attribute to a URL of a dynamically created html contents rather than a static html file. Thanks.
7
4872
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+ doesn't seem to have the problem. I'm doing: this.iframe = document.createElement( 'iframe' ); this.iframe.id = this.id + 'wh'; this.iframe.style.display = 'none';
2
2879
by: Robert Oschler | last post by:
I have an IFrame whose document is created completely by Javascript code at runtime. The document in the IFrame accesses Javascript functions in the top level document. This works fine most of the time. But every now and then, when I hit the back button, the browser suddenly thinks the Javascript created document in the IFrame is not from the same domain as the topmost document, and therefore I start getting "permission denied" errors...
3
1607
by: webEater | last post by:
Hi I have a problem with a piece of javascript. i am working on a workaround for non ajax compatible browser like ie 5/6 without activeX and opera8- I use dynamically created iframes and forms to make a request, a simple version for you to understand:
1
5287
by: XP | last post by:
Hello Everyone, I was stuck with this really frustrating problem for sometime. Let me explain what I am trying to achieve: There is a form and an inner iframe. The form's target is set to the iframe so that when the form is submitted, the page does not get reloaded/changed ( as the iframe would be the one getting refreshed. The Iframe is set to have 0 width and height to make it look invisible ). I have a copied the html source ( at...
0
1372
by: mem | last post by:
Hello, I'm a novice at this and am trying to solve a problem reference IFrame. The following code is for a page I've created. It works well with two exceptions. The IFrame is an application hosted by a third party that has no problem with me framing their page. The problem is when the user reaches the end of the first IFame page and clicks continue which reloads the IFrame to page 2 of a total of 4. Each time the Iframe page changes the main...
1
3173
by: John L. | last post by:
How do I invoke the scroll() method of a window object for a scrollable IFRAME element in an HTML document? I am using IE 7.0, and I thought the following would work: document.frame01.scroll(x,y) or possibly document.getElementById('frame01').scroll(x,y)
23
6637
by: vunet | last post by:
It is recommended by some sources I found to create IFrames in IE using document.createElement('<iframe src="#">') instead of document.createElement('iframe'). Why and what browser versions to use it? IE5 or IE6? Thanks
2
31779
by: tridirk | last post by:
Hi; I am getting a Objceted Expected Error on my forum site. I can't find what is wrong? Line: Char: Error: Object expected Code:0 the site is My SMF Forum
0
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9589
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7626
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3830
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.