I need setAttribute "src" from main windows to pop-up window (Iframe in it) and also i need to prepload all src files ONCE, so if user ever click to open pop-up and do it againt, its no need to loading againt, can anybody help with the script ... ? Or maybe can sugest me with better method to have same result.
What I want to do is access a remote web page via DOM and read some of the data by loading it into an IFrame. However I get an access denied message. Apparently you cannot have read access to an IFrame if it contains a foriegn domain.
Originaly my plan was to manipulate the information via DOM from an Iframe so if thats not an option, is there a way to store a web page in a text var and read it via the DOM that way?
Or perhaps another way? What do you guys think is the best way to accomplish this?
Anyone know how to change the visibility of a DIV in one window from another (pop-up) window? The pop-up was generated by the window with the DIV. The situation: I've got 4 DIVs in the main window with only one showing at a time (it's a multi layered form). The pop-up window is generated from the main window when a user wants to edit certain form fields. When they've completed their edits in the pop-up and submit the main window refreshes with the new data, however the main window defaults to showing the first DIV and hiding the others. When the pop-up is generated from the 2nd, 3rd or 4th DIV I'd like to bring the user back to that DIV, not the first.
If I use a window opener to open a new window, is there a way to detect that the new window is finished loading before carrying out some other directive in the opener window? Can I access the remote window's onload event from the opener window? I need to know that the website has loaded before moving to the next page. something like:
Is it possible to remote modify an already open window form from a local HTML file? Example (simplified):
1. I have a local HTML file, where I have some kind of link. When this link is pressed, then I need to add a "searchstring" into... 2. the second already opened window form (e.g. Google)
I need to do this to avoid any copy / pasting of these values.
All I have read about is that this is possible if I use Parent/Child windows, but I would like to know if this is possible to do between two independant pages?
I have a page that displays in an iframe. How to get the index of the iframe in the parent window in which my page is getting displayed using javascript.
HTML Code: <html> <iframe src="A.html"></iframe> <iframe src="B.html"></iframe> <iframe src="C.html"></iframe> </html>
if I run the javascript from B.html then I should get the iframe position as 2. same way, if I run the javascript from C.html then I should get the iframe position as 3.
this script updates an image on a page and resets the class name of a link. Works fine in Mozilla browser. However, the setAttribute method in the second function doesn't work in IE. Is there a known bug connected with this?
Any ideas?
var view; //update image function getView(view) { var source = view.getAttribute("href"); var imgsrc = document.getElementById("view"); imgsrc.setAttribute("src", source); setClass(view); } // update class names of links function setClass(view) { var arLinks = document.getElementsByTagName("a"); var ct = (arLinks.length-1); for (var i=0; i<ct; i++) { arLinks[i].setAttribute("class", "inactive"); } view.setAttribute("class", "active"); }
I am struggling to write an meta element in JS. The meta element in question is the refresh element.
This is the code I am using
//---------------- function setMetaContent(metaTag, metaName, value) { //----------------
var metas = document.getElementsByTagName('meta');
if (debug) alert('[setMetaContent] metaTag='+metaTag+' metaName= '+metaName+' value '+value); for (var i=0; i<metas.length; i++) { if (metas[i].getAttribute(metaTag)==metaName) break; } if (debug) alert('[setMetaContent] i='+i+' value '+value); metas[i].setAttribute('content',value); }
I'm in the process of migrating a script to use DOM core methods but I've hit a roadblock in the aforementioned browser. The following code snippet illustrates what I'm basically trying to do, it really is incredibly basic!
var newimg = document.createElement('img'); newimg.setAttribute('id', 'placeholder'); newimg.setAttribute('src', 'images/large/courtyard.jpg');
I'm then positioning the element on the page using appendChild(). Everything works perfectly on Firefox 1, IE5+, Opera 8, Konqueror 3.3.1 (Linux) but not in Opera 7.54. I suspect the element is being created as associated styling on #placeholder is being applied (just some padding and borders) but the image itself is not being displayed. I assume therefore that the problems lies with setAttribute()?
This seems like the sort of problem that others would have encountered, but I haven't been able to find mention of it anywhere.
I did some searching around, but didn't see this addressed directly. Here is an example of when dot notation fails in Firefox, and when SetAttribute doesn't fail: Code:
this works perfectly in firefox - but in internet explorer it just creates the first lable and the input field, although it creates the input field as a regular text field instead of for files. the caption label and text field aren't created at all. any ideas? Code:
But I would like to put it in a function to make it general for any element that has the 'onclick' property. Is there any other way to set the 'onclick' attribute & to be understand by IE & FF?
NOTE: I also found that I can not set 'colspan', I have to set colSpan. Also, I can not set 'class' I have to use the canonical method with 'object.className=...'
I know there is a problem with IE (I wont bother inserting a witty comment here) on handling:
setAttribute('onclick','doStuff');
I have found
yourAnchor.onclick = function() { // do what you want in here. }
this works, but I the script I am working on is going through every DIV with a certain class and adding links to the div, I want the button to change something within the div where it is located so I need to pass the id of the parent div. I thought perhaps there was someway to find the id of the button pressed?
Just after upgrading from v1.4.3 to v1.4.4 I started receiving this javascript error on the console, but apart from the update, I didn't do any code modifications. If I follow the console link, it takes me to this point in the source:
[Code]...
with the line in red marked as the error source. What could it be causing the error?
Im writing a piece of javascript that dynamically adds a link to a page, this is the code i'm using
var newP; newP = document.createElement("a"); newP.innerHTML = "Click here";[code].........
However, it wont work?!?! the link appears in the right place on the page when i remove the line newP.setAttribute("href","http:[url]......);and if i view the source the link is <a>Click here</a> (without any href) so there's got to be something wrong with that line but i don't know what it is.I'm using firefox.
It works OK in IE and Moz, but in Opera the change of the attribute's value works on once, first time. No error. That confuses me. Why works only once? Any ideas? Code:
I have multiple attributes (class, id and title) that is needed to insert into a div together. All I know how to use setAttribute for single attribute. So the question is there an "array" setAttribute method to insert all attributes together into an element OR is there a "after" or "before" setAttribute method I can use to insert an attribute after or before other attribute?
I've been working on this for about four hours (two today, two yesterday) and keep hitting the brick wall. I'm trying to create a function that will add an attribute to specified tags. As the title says, it works great in FF and not at all in IE7. Probably the first question you'll ask after you see my code is "why?" Well, I've got a form with over 100 form fields in it, and if I can avoid manually adding an attribute to all of them, I'll take the JS route.
I am wondering how Back, Forward browser button works for iframes. Does it bring back/forward iframe or top window? I remember I had before a problem because I wanted to bring back iframe and not top window as it did. But today I tested my Facebook app and was surprised to see it works as I need which means it brings back/forward iframe window and not top. Is it possible that Facebook has some javascript code which does that or is this normall behaviour?
I created a prototype.js/window.js "Window" pseudo window div with another page from the same directory loaded in its iframe I could not put a button/link on the iframe doc that would close it by calling functions in the parent window
I used "window.parent" "parent" alone "top" but the only thing I could access from the iframe was the window.parent.location property I ended up constructing the Window by writing the content to it from the main page, not loading a url in the iframe
But it bugs me that I couldn't access the parent window functions (or anything, getElementById didn't work either, so Window method $('Window_ID').close() wouldn't work either)
function subCat(){ var d = document.all; var i = d.sid.value; if(i != "-1"){ window.location = "subcat.php?sid="+i; } }
That is called on the following drop down menu: <select name="sid" class="dropBox" id="sid" onChange="javascript:subCat()"> <option value="-1">Please Select</option> <option value="1">category 1</option> <option value="2">category 2</option> <option value="3">category 3</option> <option value="4">category 4</option> </select>
It works fine in IE but not in Mozilla Firefox, what do i need to chnage to make it work correctly?