473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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.parseJSON is not a
function". And this:

notes = str.parent.parseJSON();

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 2612
On Aug 21, 8:30 pm, Andrew Poulos <ap_p...@hotmail.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.parseJSON is not a
function". And this:

notes = str.parent.parseJSON();

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.parseJSON is not a
function". And this:

notes = str.parent.parseJSON();

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.parseJSON();

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript 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...@hotmail.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.parseJSON is not a
function". And this:

notes = str.parent.parseJSON();

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.String.prototype.parseJSON.apply(str )

Peter

Aug 22 '07 #4
Peter Michaux wrote:
On Aug 21, 8:30 pm, Andrew Poulos <ap_p...@hotmail.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.parseJSON is not a
function". And this:

notes = str.parent.parseJSON();

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.parseJSON();

didn't work (it gave the error "parnet.str jas no properties") but the
following did:
window.parent.String.prototype.parseJSON.apply(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
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...
1
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...
7
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...
9
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...
5
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...
3
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...
3
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...
4
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"> ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.