ONLOAD Is There An AfterLoad Alternative (Iframe Problem)
Jul 23, 2005
Is there any way I can check to see if a document is loaded into the
iframe before I call onLoad (sort of an afterLoad).
I'm loading up a page into an iframe. But because we use four servers
which use load balancing, the content isn't specified straight away.
Therefore as I'm using onload to resize the iframes scroll bars to the
size of the iframe content, I need to wait for this to be loaded
first. Is there an alternative to onLoad that will do this?
I'm working on integrating the a javascript wysiwyg editor (Xinha) with my blog software (ExpressionEngine, aka EE). EE has extensions now so it's easy to get the Xinha header code into the head section of the EE web page.
But Xinha likes to use an onload command to launch:
window.onload = xinha_init;
....and EE is already using the onload command in the body tag of the web page:
I have a text box that gets its name, id, and value from a SQL query.
[Code]...
My problem is that when the page loads with the values from the SQL query, I want all of the text boxes to run their upperCase function to change their respective background colors and I cannot figure out how to do this when the correct responses and initial text box values are set from the SQL query.
I thought I was genius when I put the onload event in there (which obviously doesnt work with an input element).
I have a form.htm which has a simple form. When I press the submit button it posts the input to a formpost.php and sets $q=$_POST["input"];. Now I want to display static information at the top of the formpost.php and display the dynamical content of the rest below that. From my knowledge this is only possible with an iframe (if I use a <div> I get "Header already sent" message). Is there a possibility to post the input to an iframe on the same PHP file? My current code looks like this>
PHP Code:
Static content<br/> <script type="text/javascript"> function addLoadEvent(func) {
Talking about a js script which changes an iframe src through a "ref_to iframe.setAttribute("src", document_path);", I would like to launch a check() fct when this new document is loaded.
Of course, knowing, I don't want (and can't n some cases where document is generated by a cgi script) to edit every possible document which is potentially loadable in the iframe.
In fact, I've through about the idea to on fly add an "onload='check ()'" to every document, but don't know how to do that :-(
Maybe using attachEvent or something arounnd this : I don't know. Of course, I wish a solution working in the majors browsers.
I have a parent page containing an iframe. The parent page has a menu in it which opens links in the iframe. I want to highlight different bits of the menu according to which page has loaded in the iframe.
So I would like to do something like this:
1. Use PHP to extract the file name (minus 'php' at the end, of the page loaded within the iframe (which I can do fine).
2. Use javascript onload so that the iframe sends this value (say 'pagename') to the parent page when it loads any page in the iframe.
3. The parent page, having received that variable into its header, will adjust a line of css to something like: .pagename {background-color:red;}
And so the menu link for pagename.php will be colored red
4. When pagename1.php is loaded into the iframe, that will send 'pagename1' to the parent page, change the CSS in the head, and therefore change the highlighted menu item from pagename to pagename1
Is this possible? And easy? There seems to be a lot of stuff online about moving variables from iframes, but mainly in the context of form entries from an iframe to a parent, eg here:
[URL]
parent.function_name(); seems to be needed along the way. But I am not sure how to proceed.
I've been using a hidden iframe for remote server scripting - how i've been doing it is that a load(); function changes the src component of the iframe with $_GET variables to pass to PHP:
The frame itself then has an "onload" function that calls a doLoad(); function that handles receipt of any information back from the server. declared this way:
The trouble with this as you may guess is that the page was reloading every time src was changed and the history list of the browser was messed up. So I did some research and came up with this method that solves that problem:
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.
When I use the HTML tidy tool in Firefox I see the following warning which I want to get rid of . I cleared all the errors and warnings it showed except for this one. I am not able to get rid of this, can someone help me find a solution.
Warning: <iframe> proprietary attribute "onload"
I have the code defined like this where it throws the warning. I have tries different DOCTYPEs ( strict and Transitional) but still the warning persists.
I'm having a hard time figuring out why the onload event is not being called for the frameset window in the following simple example. It is being called for each of the component frames. Code:
Specifically, window.onload appears to fire before all the elements of the page have been rendered. As the difference is consistent across IE/Moz/Opera, I'm assuming it's deliberate - can anyone point me towards where this behaviour of window.onload is defined in the documentation? TIA. Code:
Currently I use an onbeforeunload method, to do call various tidy up methods when a user exits my web application - however I now need to add additional support, for users migrating to Sun's JVM.
My understanding that the onbeforeunload call is a Microsoft one, and the net result of having it in a page used by a SUN JVM user is that the browser does not close.
Does anyone know of an alternative to this method, that is supported by Sun's JVM?
In my webpage I have an embedded Windows Media Player and an unordered list with a table of contents.
When playing a video, the Windows Media Player is triggering events for new 'chapters'.
The corresponding chapter in the unordered list is then highlighted with css.
The list can contain up tot 100+ items. Because the page itself should fit the screen without scrolling, i put the list in a scrolling div.
I also want the div to scroll automatically in order to keep the current chapter inside the visible scope of the div.
Right now i do this by initually creating an anchor for each listitem. When an chapterswitch event occurs i scroll to the corresponding chapter with the folling line of Javascript code:
window.location = "#" + ListItemId;
There is one problem; the annoying tick sounds in IE. For my application it is not rare to have 25 'chapters' switched in one minute, so that's an awful lot of ticking.
I was wondering if it is possible to automatically scroll up or down to a specific point in a div without the browser making any sounds.
I was wondering if anyone can help me? I am having some problems wit the <noscript> tag.
I actually use it to block banner advertisements from being displaye in my website. I have used it at the <body> tag section and look something like this:
<noscript> <body> </noscript>
What it does is stop the banner advertisement offered in most fre websites from loading.
My question is how come it does not stop the banner from loading if was to view the webpage in my Pocket PC using Pocket Internet Explore Pocket IE)?
Everytime I load the page in Pocket IE, it displays a standard banne that is found in all pages viewed using Pocket IE. I looked around fo some answers and I found out that Pocket IE found in the Pocket PC 200 does not support the <noscript> tag.
Is there another way around this? I have written some pages that wil load in my Pocket PC and I find it very annoying to see the banne advertisement at the top. Code:
I was wondering if there was an addLoadEvent alternative, that could be used before all images are loaded? I think it's something like when the DOM is ready...
Code: var tabs = new Control.Tabs('menu'); var pattern = 'tab='; var nStr = location.href; if(nStr.match(new RegExp (pattern,'gi'))){ var id = nStr.split(pattern);
[Code]...
It searches for the query string 'tabs=' and then splits the result to get the id of the tab. Then it uses this to set the active tab. If the url doesn't include the query string it set the tab to the first one.
The code works but it uses Eval to convert the id string (id[1]) to a variable and I was wondering if there was an alternative.
Is there a more concise way to do something like the the desired code below?
The gripe is with the try-catch syntax. It takes *way* too many lines of code to evaluate a conditional expression when zero or more parts of the conditional expression may trigger an error. In this case, the trigger is a call to a non-defined (null) object.
In other words, how can you do a more simple 'try' statement that simply spits out true or false, depending on whether the 'tried' code threw an error or not?
Defining a function don't seem to work because you can't pass the 'try' code as an argument. Extending the 'Global' constructor is not an option, so now what? Code:
I have a query on browse button, In my page , i want to upload files , But i dont want normal <input type=fileto be used for this, so can anyone tell me anyother alternative solution for this , Here I have a button and textbox, if i click the button, it should popup a file upload dialog box ,after selecting a file, that path should be pasted in that textbox...
I want to use an anchor tag to invoke some javascript and I've read that it's bad form to use <a href="javascript:foo()">
I've read endless usenet posts and hint sites on the net, they all suggest different things and I can't get any kind of consistency, and I can't find any solution that works properly for IE, opera and mozilla.
many of the recommended solutions go something like this:
<a href="javascript:void(0);" onclick="foo()" />
this generates an <a> that looks like a hyperlink (good) and it invokes foo() as well (also good). the problem is that if in function foo, I put
window.location.href = "some new url";
it just seems to get ignored. If I miss out the href altogether, the link works but it's not formatted as a hyperlink.
All I'm trying to do is make something that looks like a normal hyperlink but whereby I can build the URL with some javascript rather than having it coded into the HTML, and I have to say it's driving me mad!!.