Accessing Body Of An Iframe, Works In Ie Not In Mozilla.
Jul 23, 2005
I am relatively new to javascript and am working on a script where I
want to utilizes a couple of iframes and format text in them. I have
run into a problem with getting the following code to work in mozilla.
It seems to work in ie.
Eventually I will be replacing the H1 node with a table until I can get
the H1 node to show up in mozilla there is not much point.
I have tested using both a javascript created iframe and one built in
the html file. In both cases the iframes have an id of something_ifr...
I'm trying to make my body content scroll at the same time as an iframe located within the body. This has to do with the age old problem of mouse focus on iframes. When my mouse reaches the iframe and it takes over focus, I would like the body to keep scrolling until the iframe is right at the top of the screen. After that I want to relinquish focus to the iframe. I don't mind if the iframe starts scrolling as soon as the mouse reaches it, so long as the main body keeps scrolling for a while.
but it doesn't work in Mozilla 1.4. I tried using name="area1", but that didn't work either. Is there any way to referrence the attributes of an <area> tag in Mozilla?
</html> It didn't work. I also tried both of these: document.getElementsByTagName('body').setAttribute('bgcolor', '#000'); document.getElementByTagName('body').item(0).setAttribute('bgcolor', '#000');
I have some functions in a script in which I'm manipulating the innerText and background colors of certain rows in a table. The lines below work OK in IE but when I try them in Mozilla, I get an error that says: "document.getElementById('TableX').rows is not a function".
This works in IE and NS4 but in Mozilla (Firebird) it displays part of the javascript as page content instead of scripting. It's a very old 'mouseover generator' that writes javascript that had so many requests when I removed it I had to put it back in.
Following function works for IE, but not for Mozilla FF. I am truncating the string to size =20. Also I am using custom attribute att as I have too many tags inside a <td>.
function trunc_dest() { var x = document.getElementById('chtbl');
var t = x.getElementsByTagName('tr'); for (var i = 0; i < t.length; i++) { var d = t[i].getElementsByTagName('td'); for (var j = 0; j < d.length; j++) { if (d[j].att == 'dest') { // var e = d[j].innerHTML; var w_str = unescape(d[j].innerHTML).split('<'); // alert(w_str[0]); if (parseInt(w_str[0].length) > 20) { d[j].innerHTML = w_str[0].substring(0,19)+"...*"; } } } }}
I am making a visual database for our company to give to our sister company in another state so they can have name, phone, email, and a picture. All of this information is in XML outside of the HTML document. I have provided the HTML and XML below. It works perfectly with Mozilla, but all Internet Explorer displays nothing from the XML. Please tell me what I'm doing wrong because I am completely stumped
I have the following code which deletes, i.e. sets the cookie in the past, a cookie.
var cookie_name = 'memberCookie' var cookie_date = new Date(); // Current Date & Time cookie_date.setDate (cookie_date.getDate() - 5); var cookie = cookie_name + "=; expires=" + cookie_date.toGMTString() + "; path=/"; parent.menu.document.cookie = cookie; parent.menu.location.reload(1) parent.menu.document.cookie - this is just the path to the cookie which resides in a frame called menu.
This code works in Mozilla, as it stores the cookie by name i.e. memberCookie, however in Internet Explorer the cookie file is named ti8@localhost[1] which is just my username and server name from uni. Is this the reason it cannot delete the cookie? Or despite the file being called ti8@localhost[1] the cookie is really named memberCookie?
Can anyone please provide any advice for me. Would I need two seperate statements, one which deletes the cookie in Mozilla and one for IE?
Lets say I have a Javascript function, and want to start it on onload. This is what I've done:
<script language="javascript" type="text/javascript"> function blabla(){ } </script> <body onload="blabla()"> </body>
Well the function will return a value depending on the users installed toolbars. Unfortunatly this works only for Internet Explorer, I have tried on FireFox and it doesnt work :S Any way to load a function on startup with firefox?
I've written a jQuery script for a crossfade slide show. My script works fine when I put it it the body section of my HTML. But when I move it to the head, the script no longer works. The div where the images are supposed to appear remains blank. Does this matter? Does this mean that there's a flaw in my script? Should I be worried? Or should I simply leave the script where it is in the body section.
I call a javascript function in my page load that accesses an iframe and I get an error. But if I wait till the page completely loads and access the iframe through a click event everything works fine.
I'm trying to set some of the iframe's properties on page load. Can I do this?
I have a situation where I'd like to read/parse the content of a file I've read into an <IFRAME>. I've looked through various FAQs and searched forums, and the closest I get to accessing the file content is
myIframe.contentWindow.document.body.innerHTML
where myIframe is the node from getElementById(). But while I can see the content of the file on my web page, I get an empty string from the above reference. How do I get to the file?
The iframe has a bunch of <span> elements in it. I need to access the innerHTML of the spans, to check for data and use the data elsewhere. Each span has an unique ID assigned to it. What would be the syntax to read this information? I've tried all sorts of document.frames["search_frame"].getElementById("ID").innerHTML variations to no avail.
I'm currently trying to get the contents of an iframe's body without any mangling of content by the browser.I could do it by including the content in a textarea, however i want to avoid that.using .innerHTML results in special characters such as "<" ">" and "&" being converted to "<", ">", and "&"respectively.To test, build an html file containing:
{ "id": 5, "testtext":"I am > than this & < that",
This should be an easy one for a change... I just can't figure out the DOM addressing format... either that or its just not possible.
I want to change the body align attribute of the content of an iFrame. The 'why?' is a bit convoluted, I just need to do it from a bit of JavaScript.
I have tried:
Code:
And the FF error console (it will be used mainly in IE but the FF error console is nicer ;-) ) tells me that document.getElementById('myIframe').document is not defined.
I know that document.getElementById('myIframe'). is defined as I can set its src value to load a page, so I'm guessing that the loaded document isn't called document in the DOM.
Can anyone point me in the right direction to being able to manipulate bits of the docuemnt laoded in the iFrame - the body attributes particularly to start with?
I have a selection list in my form. I also have an iframe in this document.
I am trying to access the selection list from my iframe as given below. It works in Firefox but not in IE.
var aaa = "navigator"; var bbb = aaa.appName; var selopt = ""; if(bbb == "Microsoft Internet Explorer") { selopt = parent.document.getElementById("select1"); - - - - - here i am able to get the object } else { selopt = parent.document.getElementsByName('select1')[0]; }
IE : var val = selopt.options[0].value; - - - - - - -here i am not getting the value.
There must be a standard way of getting the body of an iframe, and adding content to it, using jQuery. what the "best practice" way is? That works in all browsers?
I have a Body onload event (to load the chained Menu) and a windows.onload event (to load the IFrame Ticker).If I open the page in Internet explorer both scripts function; however in Firefox I'm having problems.The Chained Menu works, however the IFrame Ticker does not display. Both events ahave ben placed on the boady tag.how I can get both to display in Firefox.
I am trying to write a Greasemonkey script using jQuery to automate various processes on a web site. One of them involves automatically filling in a form located in a dynamically generated iframe. When the frame is generated I can do $('#NewFrame').length and get 1 confirming it is now available. However, when I do $('#NewFrame #TheForm').length I always get 0 even though I can clearly see the form there in the iframe.
<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font:inherit;">Is this possible? Been trying but doesn't seem to work...</td></tr></table>