Catching Information From Other Frame
Apr 18, 2005Can I get information from other frame, like form values or variables?
View 5 RepliesCan I get information from other frame, like form values or variables?
View 5 RepliesI have a main page ('index.php') with an iframe ('mainframe') on the
left hand side. All the links on the index page load a new page of
mainly text content into the iframe.
All pretty straightforward, but I am using some javascript to launch
and hide a floating div on the index page (if I launch it in the
iframe, it will be restricted to the height and width of that frame).
The code to show / hide the div is located on the page index.php - say
the function is called 'showMe()', I would call top.showMe() to launch
the div.
The Div works fine, but when I try and catch an event via:
event.srcelement
it returns the error message 'object required', because it is being
passed from a link on a totally seperate page (the iframe)...
Is there any method for the main page (index.php) to catch the event
on 'mainframe' that triggers the div ?
The div's do show up and hide, and I can load source content into them
- only error messages keep flashing up on IE (but not on Netscape /
Firefox, etc).
I have a HTML form containing two text box controls in it and a submit button. When a user enters information in those two textboxes and click on submit, the information is sent to a function in Javascript. In the javascript, the information from those textboxes is stored in a javascript variable. The problem is as follows:When I am inputting string text in the html text boxes and in the javascript when I am trying to print those values, it is giving me out an error saying NaN. However when i input integer values in the text boxes it is printing those numbers. Is there a conversion that I have to do for the string to be printed. I am new to Javascript and need your help. This is a basic code of Javascript. Below is the code that I have.
<html>
<script type = "text/javascript">
function square(form)
[code]....
Has anyone tried working out this one?
How to detect IE4 without wrongly detecting IE5.0 (IE5.0 usually returns a navigator.appVersion of 4.0)
Here's the code im working with using substring of IE version:
// <head>
<script language="JavaScript">
this.version = navigator.appVersion;
</script>
// <body>
<script language="JavaScript">
if (navigator.appName == "Microsoft Internet Explorer"){
if (version.substring(0,1) <= 4){
if (version.substring(22,23) <= 4){
document.write("This Browser is IE4 or lower!");
}
else{
document.write("This Browser is IE5 or higher!");
}
}
}
else{
document.write("This Browser isn't IE!");
}
document.write("<br>This Browser is " +version);
</script>
The version string usually return's something like this:
4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
Can anyone see any problem with using this method?
I am trying to catch keypresses in my canvas tag, but it appears that
that is not valid.
I may try to just create a hidden input box that will allow me to catch
keypresses.
I am trying to write a very simple asteroids game for a presentation on
Ajax in July, to show that javascript can do more than it was able to a
couple of years ago.
Is there a way to catch when a div content is updated through javascript? I update a div content through rjs and I need to call tablesorter every time the div is updated.
View 3 Replies View RelatedI have a domain: example.com; which is the parent.And a subdomain: api.example.com; which page 'receiver.html' is being loaded in an iframe, child of parent. Both pages set document.domain = example.com.
I'm trying to adapt this code:[url] but Idon't want to load jQuery from the <iframe> again but I need to have the method $.ajax() working from the <iframe> otherwise it would be a cross-domain request and the browser would abort it. I tried ingenuously to set via $('iframe')[0].contentWindow.$.ajax = $.ajax() and I just got a shortcut to the parent page jQuery method. I also tried to "clone" it using $.expand (true...) but the method doesn't work for me; probably because of the complexity of the objected I'm trying to clone. So is there a way for me to use jQuery to have only a $.ajax() method in the <iframe> ? I've thought even about creating a XHR in the child-iframe and then use that in the $.ajaxSetup ({xhr: THATNEWXHR}) but I couldn't do it. I mean, I want to use the XHR factory from jQuery (which has fallbacks for IE, etc) but it has to be created from the iframe-child.
Maybe there is other way to make the AJAX call come from the child-iframe.
If you're wondering "why don't you load jQuery from <script> in the child-iframe", there is a reason... As I'm using jQuery plugins + my own custom javascripts + other independent scripts I created a compiler which minifies each file and bundle them in one. The advantage of this is the reduction of HTTP requests. So "why don't you load that bundle inside the child-iframe?", because it's ugly and Twitter doesn't... Yeah, I like to take Twitter as a reference and I think if they were able to make it so can I;
I got to work in most browsers except IE and Operaby doing it with pure javascript.
I'm "attaching" the code for you guys to test. If you open it with Chrome, Safari or Firefox you will receive 2 alerts one with the return of $.get() and another with the return of a request made via XMLHttpsRequest object. Otherwise (if you open it with IE or Opera) you'll get 'undefined' in the first alert but the real return in the second.
This is the example.com/index.htm:
Im trying to make a back button that reloads the previous page the user was at.
The back button will be on a small top frame and the page that needs to be controlled will be in the main frame.
The top frame is just a navigation system, and all pages will be loaded in the main frame.
Im trying to use this Code:
<FORM>
<INPUT TYPE="button"
NAME="back"
VALUE="BACK"
onClick="history.go(-1)">
</FORM>
Does anyone know how I could accoplish the desired result using this code, or any other code? And what about a foreward button?
How may I catch all postback events which are triggered by all controls using jQuery in an ASPX page?
I am using the below provided code and displaying an alert window when any control posts back to the server, however not all postbacks are getting caught by the highlighted code.
protected void Page_Load(object sender, EventArgs e)
{
if (Request.ServerVariables["REQUEST_METHOD"] == "POST" || Request.ServerVariables["REQUEST_METHOD"] == "GET")
[Code].....
I want window.onerror type functionality in webkit.
Is there any way of doing this?
My best attempt was:
Code:
Which breaks Chromes console, but doesn't get triggered for internal errors (e.g. reference errors).
I'm trying to implement a php style __autoload.
Essentially I think it's possible to
-Catch the error
-Find out the name of the object which isnt referenced
-Try to include a JS file with the same name
I have a page contained in an iframe. The page contained in the iframe shows videos all the time.Each video has an id that changes when a new video is played.I need to be able to catch this changing id in the page that has the iframe (the parent page) and that is hosted in a different server from the contained page.The only languages that can be used in the contained page are javascript, ajax and jquery
In the parent page you can use these languages + php.
I'm not posting the contained page code just because, believe me, it's humongous,full of variables and functions from other files and modules.The only thing needed there is a variable, myid, that stores the new id when a new video is played.Then I have to post, send, throw ... etc. myid and after that catch it in the parent page, remembering that myid's value changes when a new video is played and that.I have to get that new value at all times.I have to get the value of the playing video id to do things like changing the background of the page depending on the video played or showing a webpage depending on the video played ... and so on.
I want to have a main image in place and when you click on 1 of the 3 frame options the frame changes showing a preview. Also I would like the add to cart button change its code to add the correct item as well.
View 2 Replies View RelatedI'm sure someone has written about this, but my google-fu is utterly failing me!Say I make an ajax request:
javascript Code:
Original
- javascript Code
errQueryFailure = new Error ("Server query failure");
[Code]...
i need to pass the data in the textfields from the left frame to the textfields in the right frame of my frameset. (ex: dslnum of frame1 will be pass to txtDSLTN of frame2)[URL]
View 19 Replies View RelatedI have two frames (frameset, let's call it frame1 and frame2). Frame1 has links..., and frame2. When some link in frame1 is clicked, it must be changed content of the frame2. Here's example: click. How to do that? (I don't see any javascript code)
View 2 Replies View RelatedI have a parent document that has a frameset with two frames in it. The first frame is a "header" that runs across the top of the site, and never changes. The second frame contains the "content" of the site. Essentially, I am trying to figure out how to prevent the header appearing above external sites when the user clicks an external link in the "content" frame.
Every time the content frame changes to a new URL, I would like the check that URL and determine if the content frame is changing to an external URL (i.e. different domain in URL) or to an internal link (same domain in URL). If the content is changing to an external link, I want to break out of the frame and just load that external link in the top most document.
I would like all of my javascript to be in the parent document, not spread throughout the individual pages of the site. I was trying to approach this by setting the onunload event handler of the content frame, but I am left with a couple of specific questions:
1. In handling an unload event, can you determine the next URL that the document is loading? Code:
I have a little problem, I structure my site with a main page index.html with a frame in the central whit name CENTRALE, so every other page I will open within this frame. Now I need to have a direct link to these internal pages, give an example I wish it were possible to go to the page clothing giving a direct link to that section of the site type www.indirizzo.com / clothing.html because the state of things if I take the 'direct address to that page I open only the part inside of the frame, but I wish I would open inside the "main frame, there is a solution in javascrip to overcome this problem?
View 4 Replies View RelatedThis is the code I am using to test this. In FF and Op. When I click on an option in the select box, the alert pops up. In IE and Chrome, it doesn't seem to catch it at all.
$('.clickopt').mousedown(function(){
alert("test");
});
Catching <a> link click - Fancy Box I have an example here of the simple image gallery I'm working with. The thumbnails are loaded from an XML and are linked to larger images. untitled I want to use Fancy box Fancybox - Fancy lightbox alternative to show the larger images. I have fancy box working on other sites but can't get it to work here. In an attempt to work out why it's not working I tried to capture the click on the <a> link, but that won't work.
[Code]...
It would be easier to explain this if you play mafia wars (or any game that includes intra-game exchange of gifts/items between members) but the actual scripting doesn't require any knowledge of the game.
Background Information
Mafia Wars is a game on Facebook (and myspace, yahoo etc.) that among other things allows its players to send gifts to each other. Now because different people end up with more things of one type and are short of things of another type, the players have evolved a trading dynamic. Where x number of Item 1 is traded for y number of Item 2. A simple marketplace. And with this territory come scammers.
Essentially a player who doesn't go through with his end of the deal. good player sends item to bad player. bad player removes good player from mafia and blocks him for ever contacting him through his facebook profile. This has given rise to my group, among many others, that lists these scammers (identified with their facebook profile ids) as they are reported every day. Now over time the list has grown and it has become difficult and unrealistic to expect people to know who is on the list and who is not.
The Requirement
A javascript bookmarklet (there are many already servicing different needs of the players) that sits on the browser and tells the user if the person he is about to trade with is a listed scammer or not.
The Breakdown
The user will click the bookmarklet when he is on the facebook profile of the person he is about to trade with. When clicked the script will pull the facebook profile id from the current page, and then scan a text file located on a third-party server and return with a pop-up box message that reports if the id is listed as a scammer or not.
If visual basic and firebug doesn't show me any error and if code doesn't work on any browser...so what should i do. I did a little boring - to read my code again to find a simple syntax errors like - writte() for exemple.
But even that does not give me anything! Is there any good recomendations how to change it all?
Look at this code:
Browser gives me out only - Please enter a valid name
I have a frameset with two frames; topFrame and mainFrame. I have code in topFrame and wish to print the contents of mainFrame. The code that I have used has worked for many years and still works on my localhost Apache Server. However, it has now "stopped" working. When I press the button in topFrame it prints the contents of topFrame The code that I am using is
Code:
window.parent.mainFrame.focus()
window.print
I have tried to replace the first line with..
[Code]...
I use dreamweaver mx html editor to make web sites. I think I know enough Html to get by. My new site uses a frame set so the head and controller don't change reload or move. This works nice, now all I have to do to make a new page is make the content page. But my problem is if I send out a link for someone to look at, it only loads the content page and not the frame set. I thought I could use javascript to determine if the frame set is present and if not load it. But I can't seem to find a way to sent variables from one frame to another. Also if a user clicks a link I would like my flash controller to reflect it.
[Code]...
I need to know how to refresh a bottom frame TO a specific dynamic URL from my top frame (meaning the code has to be in the top frame) say every 5 seconds. The top frame will be a php file as I need DB values. But I believe the frame thing is done via javascript. This ain't working so far, it only loads the first URL at not the rest. Is there the ability to refresh to a specific url in a target frame. Code:
View 5 Replies View RelatedOne more question about manipulating iframes. In a script I've looked through to investigate AJAX file uploads, there is this technique for accessing the contents of an iframe:
Code:
if(frame.contentWindow)
{
var thebody = frame.contentWindow.document.body;
}else if(frame.contentDocument)
{
var thebody = frame.contentDocument.document.body;
}
I haven't been able to find much info on contentWindow and contentDocument. In fact, other sources I've found talk only about using contentWindow to access an iframe's contents, ignoring contentDocument completely. What is the difference between the two, and what browsers is the contentDocument check targeting? Any modern browsers, or is this a backward compatibility thing?
So I created a custom rule following numerous examples out on the web for a dynamic text input, but for some reason it seems to be letting spaces through even though my regexp tests out ok to not match when the value is any combination of spaces...
$.validator.addMethod("noSpace", function(value, element){
return this.optional(element) || /^[a-z0-9][a-z0-9_ ]{0,70}$/i.test(value);
}, "Please enter a name starting with either a letter or a digit.");
$('#form').validate({
rules: {
[Code]...
The odd thing is, it will work if you type in a space followed by a character, but if you type in one space, or one space followed by x number of spaces, it just lets it through like it's valid. But yet when I look at the demos and examples that I pulled this from, they never let those scenarios go through.
[Code]...