f



javascript within a javascript

Hello,

I have a multi-frame page.  The frames are named Frame_1, Frame_2 and
Frame_3.

Frame_1 has a drop down box.  When a value is selected in this drop
down box, Frame_2 is updated using an asp file (as I have to read from
a back-end access database).

In turn in the asp file, I have a Body onload tag to execute a
javascript function within Frame_2.  this function updates the contents
of Frame_3.

Till now this is working fine.

Here is the problem.  Frame_3 has a form with a radio button.  When a
radio button is selected, I want that a function be executed in
Frame_3.

However since content of Frame_3 is updated using
"window.parent.Frame_3.document.writeln(", I cannot include "<Script
language="javascript" etc within the text of the window.parent. etc
because Script within a script is not allowed.

Any suggestions on how to overcome this?

Thanks in advance.

U

0
u0107 (24)
1/10/2007 6:25:51 AM
comp.lang.javascript 38370 articles. 0 followers. javascript4 (1315) is leader. Post Follow

3 Replies
1092 Views

Similar Articles

[PageSpeed] 56

u0107@usa.net said the following on 1/10/2007 1:25 AM:
> Hello,
> 
> I have a multi-frame page.  The frames are named Frame_1, Frame_2 and
> Frame_3.
> 
> Frame_1 has a drop down box.  When a value is selected in this drop
> down box, Frame_2 is updated using an asp file (as I have to read from
> a back-end access database).
> 
> In turn in the asp file, I have a Body onload tag to execute a
> javascript function within Frame_2.  this function updates the contents
> of Frame_3.
> 
> Till now this is working fine.
> 
> Here is the problem.  Frame_3 has a form with a radio button.  When a
> radio button is selected, I want that a function be executed in
> Frame_3.
> 
> However since content of Frame_3 is updated using
> "window.parent.Frame_3.document.writeln(", I cannot include "<Script
> language="javascript" etc within the text of the window.parent. etc
> because Script within a script is not allowed.
> Any suggestions on how to overcome this?

document.write('<\/script>') instead of document.write('</script>')

-- 
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
0
Randy
1/10/2007 6:32:32 AM
This is the exact error that I get:

Active Server Pages, ASP 0138 (0x80004005)
A script block cannot be placed inside another script block

....2.asp, line 255

And Line 255 is

response.write "
window.parent.Frame_No_33.document.writeln(" & quote & "<script
language=....

I tried defining two variables lt = chr(60) and gt = chr(62) which are
respectively the less than (<) and the greater than (>) signs and
replaced the "<" in "<script...".

Still that did not work.

I tried your suggested solution but that did not work.

Appreciate other solutions.

thanks in advance



Randy Webb wrote:
> u0107@usa.net said the following on 1/10/2007 1:25 AM:
> > Hello,
> >
> > I have a multi-frame page.  The frames are named Frame_1, Frame_2 and
> > Frame_3.
> >
> > Frame_1 has a drop down box.  When a value is selected in this drop
> > down box, Frame_2 is updated using an asp file (as I have to read from
> > a back-end access database).
> >
> > In turn in the asp file, I have a Body onload tag to execute a
> > javascript function within Frame_2.  this function updates the contents
> > of Frame_3.
> >
> > Till now this is working fine.
> >
> > Here is the problem.  Frame_3 has a form with a radio button.  When a
> > radio button is selected, I want that a function be executed in
> > Frame_3.
> >
> > However since content of Frame_3 is updated using
> > "window.parent.Frame_3.document.writeln(", I cannot include "<Script
> > language="javascript" etc within the text of the window.parent. etc
> > because Script within a script is not allowed.
> > Any suggestions on how to overcome this?
>
> document.write('<\/script>') instead of document.write('</script>')
>
> --
> Randy
> Chance Favors The Prepared Mind
> comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
> Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/

0
u0107
1/10/2007 7:11:24 AM
u0107@usa.net wrote:

> This is the exact error that I get:
> 
> Active Server Pages, ASP 0138 (0x80004005)
> A script block cannot be placed inside another script block
> 
> ...2.asp, line 255
> 
> And Line 255 is
> 
> response.write "
> window.parent.Frame_No_33.document.writeln(" & quote & "<script
> language=....

Hi,

Not sure, but I solved a similar problem once like this:

Dim str
str = "window.parent.Frame_No_33.document.writeln('<scrip";
str=str& "t language=...>"

response.write str

If you break on the script-word I might work.

Regards,
Erwin Moller

> 
> I tried defining two variables lt = chr(60) and gt = chr(62) which are
> respectively the less than (<) and the greater than (>) signs and
> replaced the "<" in "<script...".
> 
> Still that did not work.
> 
> I tried your suggested solution but that did not work.
> 
> Appreciate other solutions.
> 
> thanks in advance
> 
> 
> 
> Randy Webb wrote:
>> u0107@usa.net said the following on 1/10/2007 1:25 AM:
>> > Hello,
>> >
>> > I have a multi-frame page.  The frames are named Frame_1, Frame_2 and
>> > Frame_3.
>> >
>> > Frame_1 has a drop down box.  When a value is selected in this drop
>> > down box, Frame_2 is updated using an asp file (as I have to read from
>> > a back-end access database).
>> >
>> > In turn in the asp file, I have a Body onload tag to execute a
>> > javascript function within Frame_2.  this function updates the contents
>> > of Frame_3.
>> >
>> > Till now this is working fine.
>> >
>> > Here is the problem.  Frame_3 has a form with a radio button.  When a
>> > radio button is selected, I want that a function be executed in
>> > Frame_3.
>> >
>> > However since content of Frame_3 is updated using
>> > "window.parent.Frame_3.document.writeln(", I cannot include "<Script
>> > language="javascript" etc within the text of the window.parent. etc
>> > because Script within a script is not allowed.
>> > Any suggestions on how to overcome this?
>>
>> document.write('<\/script>') instead of document.write('</script>')
>>
>> --
>> Randy
>> Chance Favors The Prepared Mind
>> comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
>> Javascript Best Practices -
>> http://www.JavascriptToolbox.com/bestpractices/

0
Erwin
1/10/2007 10:49:07 AM
Reply: