473,769 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using method defined in frameset in frame

I'm trying to use the String method parseJSON (that is created in the
javascript of a frameset) in one of the frames but I don't know how to
correctly reference it. This:

notes = str.parseJSON() ;

doesn't seem to work - I get the error "str.parseJ SON is not a
function". And this:

notes = str.parent.pars eJSON();

also gives a similar error. If I code directly into the frameset I get
the results I expect.

Now I'm not sure where the issue is. How can I use a method that's
defined in a frameset in a frame?

Andrew Poulos
Aug 22 '07 #1
4 2632
On Aug 21, 8:30 pm, Andrew Poulos <ap_p...@hotmai l.comwrote:
I'm trying to use the String method parseJSON (that is created in the
javascript of a frameset) in one of the frames but I don't know how to
correctly reference it. This:

notes = str.parseJSON() ;

doesn't seem to work - I get the error "str.parseJ SON is not a
function". And this:

notes = str.parent.pars eJSON();

also gives a similar error. If I code directly into the frameset I get
the results I expect.

Now I'm not sure where the issue is. How can I use a method that's
defined in a frameset in a frame?
parseJSON is not a native function yet. If you use Douglas Crockford's
reference implementation the above code should work.

http://www.json.org/js.html

Douglas's code augments build in objects (eg String) and this is
considered a bad practice by many. Since it is a reference
implementation, his implementation is to show how JSON will work
eventually not necessarily how it should be implemented now.

Is the JSON from a trusted source? If so then you don't need to use
the parseJSON function which just checks the JSON matches a particular
regular expression. If it is a trusted source you can just do

eval('(' + str + ')');

which is what the json parser ends up doing anyway after the regexp
check.
Peter

Aug 22 '07 #2
Andrew Poulos said the following on 8/21/2007 11:30 PM:
I'm trying to use the String method parseJSON (that is created in the
javascript of a frameset) in one of the frames but I don't know how to
correctly reference it. This:

notes = str.parseJSON() ;

doesn't seem to work - I get the error "str.parseJ SON is not a
function". And this:

notes = str.parent.pars eJSON();

also gives a similar error. If I code directly into the frameset I get
the results I expect.

Now I'm not sure where the issue is. How can I use a method that's
defined in a frameset in a frame?
parent.str.pars eJSON();

--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Aug 22 '07 #3
On Aug 21, 8:30 pm, Andrew Poulos <ap_p...@hotmai l.comwrote:
I'm trying to use the String method parseJSON (that is created in the
javascript of a frameset) in one of the frames but I don't know how to
correctly reference it. This:

notes = str.parseJSON() ;

doesn't seem to work - I get the error "str.parseJ SON is not a
function". And this:

notes = str.parent.pars eJSON();

also gives a similar error. If I code directly into the frameset I get
the results I expect.

Now I'm not sure where the issue is. How can I use a method that's
defined in a frameset in a frame?

Oops. I think I read to fast. You are using the JSON library in the
parent? Something like this...

window.parent.S tring.prototype .parseJSON.appl y(str)

Peter

Aug 22 '07 #4
Peter Michaux wrote:
On Aug 21, 8:30 pm, Andrew Poulos <ap_p...@hotmai l.comwrote:
>I'm trying to use the String method parseJSON (that is created in the
javascript of a frameset) in one of the frames but I don't know how to
correctly reference it. This:

notes = str.parseJSON() ;

doesn't seem to work - I get the error "str.parseJ SON is not a
function". And this:

notes = str.parent.pars eJSON();

also gives a similar error. If I code directly into the frameset I get
the results I expect.

Now I'm not sure where the issue is. How can I use a method that's
defined in a frameset in a frame?


Oops. I think I read to fast. You are using the JSON library in the
parent? Something like this...
parent.str.pars eJSON();

didn't work (it gave the error "parnet.str jas no properties") but the
following did:
window.parent.S tring.prototype .parseJSON.appl y(str)
thanks
Andrew Poulos
Aug 22 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
3535
by: Hans | last post by:
Hi There, I have a page that has links with some variables and I need to open the results set in a frameset. I have tried doing this in various different ways, but still cannot get the variable passed to the relevant frames within the frameset. What is the best way of getting this done. Thanks Hans
1
11016
by: JP | last post by:
Hi, How can I create a dynamic frameset whose content changes based on user inputs? Specifically, how do I toggle a frame within a frameset? How can I allow a user to "close" or "dock" a frame by clicking on some button and let the parent update its frameset layout? What I've been trying to do is for the child frame to send a message
7
9019
by: Scott | last post by:
I need help to modify the code below to pass url variables from a framset. The click to run this will be in the mainFrame. This script works well in a non-frame page. Grabs the current url variables and adds them to my url. <script type="text/javascript"> //<!]> </script>
9
4530
by: CW | last post by:
I wrote an HTML based chat application. The front end is built entirely on HTML + javascript. Essentially, I have a hidden frame that's refreshed frequently and any new messages are displayed in another frame using document.write. My problem is that since chat screen can be obscured by other applications/windows, I have no way of informing users that new messages have arrived other than popping the window to the top using window.focus....
5
2074
by: Michelle Stone | last post by:
Hi everybody I am writing a simple asp.net application using form authentication. I store the list of all users and their passwords in an SQL Server database table. My client recently told me that he wants me to do something through which only one user can login using any given account name. I mean to say, for example, when a user called "abc" is online, another person shouldn't be
3
1422
by: powerranger | last post by:
I have aspx page called test.aspx where I create a frameset. At the top frame, I have dropdownlist box which has autopostback turned on, a hidden image (visible = false) and a button. When the user chooses an item from the dropdownlist box (after postback), I want to show/display the image in the top frame. How can I achieve this working with a frame. Here is my HTML code: <frame name="header" src="top.aspx" scrolling="no" noresize>...
3
2856
by: rajarya | last post by:
Hi, I m designing a HTML page(index.html),here i have 2 frames,by defult both frames have index1.html and index2.html as their source . in first frame(index.html) ,i have some redio buttons,and a submmit button. so when I select one ption and click the submit button in the left side frame(or frame 1 or in index1.html) my right side frame should be reloded with a new html page as per the javascript method in main html page. but insted I...
4
3748
by: maminx | last post by:
Hello..i have problem, hope someone can help me..i have this frameset below : <FRAMESET ROWS="55%" COLS="37%,63%"> <FRAME NAME="runningTrade" SRC="http://runningtrade.com" scrolling="no"> <FRAMESET ROWS="33%" COLS="51%,49%"> <FRAMESET ROWS="34%,34%,35%" cols="*"> <FRAME NAME="orderBook" SRC="http://od.com" scrolling="no"> <FRAME NAME="orderBook2" SRC="http://od2.com" scrolling="no"> <FRAME NAME="OrderBook3" SRC=""...
0
10212
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9995
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8872
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...
0
6674
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5304
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
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3962
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
3563
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.