generate a dynamic script in child frame 
Author Message
 generate a dynamic script in child frame

Hi everyone,

Something which ought to be simple!

I try to put a script in a browser child window, but I
don't succeed to write < character. Bad news, there is
plenty of < inside a script block!

My code is :
-----client side control page
<HTML>
<HEAD>
<script language=VBScript>
Set IE = CreateObject("InternetExplorer.Application")
IE.visible=true
IE.Navigate "C:\test.htm"
</script>
</head>
</html>

------test.htm page code

<HTML>
<HEAD>
<script language=vbscript>
Public buffer
Sub frameset_Onload()
buffer =("<script language = vbscript>")
buffer = buffer & "alert 1"
buffer = buffer & ("</script>")

frames("control").document.write  buffer
'frames("control").document.all.tags("head").item
(0).innerhtml=buffer
'frames("control").document.write 2

End sub
</script>
</head>

<FRAMESET border=3 frameSpacing=1 rows=100,*
frameBorder=yes onload=frameset_onload() cols=*>
<FRAME name=control marginWidth=7 marginHeight=0
src="about:blank"  scrolling=no>
<FRAME name=result marginWidth=7 marginHeight=0 src=""
scrolling=yes ></FRAMESET></HTML>

-----------

Everything seems Ok except the < and / character are not
processed.

If I write "script>", this word is written in the control
frame but of course the block is not seen as a script.

I put different ways of writing the script in the control
frame. I succeed to write simple string but no way to use
< character, even if I code it with chr(60) or with      
chr(asc("<"))

The problem is not beacause I write in the <Head> field. I
have the same problem with just writing in a single frame
body field.
By the way, I noticed a strange result when I tested on a
blank page

IE.document.write (""<" ")
I get "true" written in the IE window

but if I test

ie.document.write (""<"")
I get "False" written in the window!!!

I need some help please...
Thanks



Thu, 15 Dec 2005 07:19:49 GMT  
 generate a dynamic script in child frame
Hi,
I solved partially the problem with the following test.htm
code :
-------- test.htm code
<HTML>
<HEAD>
<script language=vbscript>
Sub frameset_Onload()
frames("control").document.writeln ("<SCRIPT
Language=""VBScript"">")
frames("control").document.writeln ("Sub document_Onclick
()")
frames("control").document.writeln ("alert 1")
frames("control").document.writeln ("End sub")
frames("control").document.writeln ("</scr") & ("ipt>")
frames("control").document.writeln ("hello")
End sub
</script>
</head>

<FRAMESET border=3 frameSpacing=1 rows=100,*
frameBorder=yes onload=frameset_onload() cols=*>
<FRAME name=control marginWidth=7 marginHeight=0
src="about:blank"  scrolling=no>
<FRAME name=result marginWidth=7 marginHeight=0 src=""
scrolling=yes ></FRAMESET></HTML>
--------------
The error was to write two times </script> in the
generating script like this

Sub frameset_Onload()
<script language=vbscript>
buffer =("<script language = vbscript>")
buffer = buffer & ("</script>") 'first times
End sub
</script> ' second times

Notice that in the parent script there are two times
</script>. That means the parent script stopped at the
first </script> encountered in the buffer generation, so
it ingored the remainder and put it in the body part of
the frame document!

My last problem is how to refer to the document_Onclick
event of the control frame in the script which is
generated inside this frame document_Onclick() is not
right. It's the right syntax for a single frame page but
not for a two frames page. I check back my frame tutorial.

Quote:
>-----Original Message-----
>Hi everyone,

>Something which ought to be simple!

>I try to put a script in a browser child window, but I
>don't succeed to write < character. Bad news, there is
>plenty of < inside a script block!

>My code is :
>-----client side control page
><HTML>
><HEAD>
><script language=vbscript>
>Set IE = CreateObject("InternetExplorer.Application")
>IE.visible=true
>IE.Navigate "C:\test.htm"
></script>
></head>
></html>

>------test.htm page code

><HTML>
><HEAD>
><script language=vbscript>
>Public buffer
>Sub frameset_Onload()
>buffer =("<script language = vbscript>")
>buffer = buffer & "alert 1"
>buffer = buffer & ("</script>")

>frames("control").document.write  buffer
>'frames("control").document.all.tags("head").item
>(0).innerhtml=buffer
>'frames("control").document.write 2

>End sub
></script>
></head>

><FRAMESET border=3 frameSpacing=1 rows=100,*
>frameBorder=yes onload=frameset_onload() cols=*>
><FRAME name=control marginWidth=7 marginHeight=0
>src="about:blank"  scrolling=no>
><FRAME name=result marginWidth=7 marginHeight=0 src=""
>scrolling=yes ></FRAMESET></HTML>

>-----------

>Everything seems Ok except the < and / character are not
>processed.

>If I write "script>", this word is written in the control
>frame but of course the block is not seen as a script.

>I put different ways of writing the script in the control
>frame. I succeed to write simple string but no way to use
>< character, even if I code it with chr(60) or with      
>chr(asc("<"))

>The problem is not beacause I write in the <Head> field.
I
>have the same problem with just writing in a single frame
>body field.
>By the way, I noticed a strange result when I tested on a
>blank page

>IE.document.write (""<" ")
>I get "true" written in the IE window

>but if I test

>ie.document.write (""<"")
>I get "False" written in the window!!!

>I need some help please...
>Thanks

>.



Thu, 15 Dec 2005 18:26:22 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. calling function in child frame from parent frame

2. Dynamic generated DownDown, Buttons, Names generates errors

3. Dynamic generated DownDown, Buttons, Names generates errors

4. Dynamic Child Drop Down List

5. Can I make a recordset available to child frames

6. Passing values from Frameset to child frames.

7. Creating dynamic generated page

8. i find a problem when i use jscript to generate dynamic table

9. Help Please! Dynamic Generated UserControl ArrayHelp Please! Dynamic Generated UserControl Array

10. Create a Dynamic generated SQL query in VB/VBA

11. Help Please! Dynamic Generated UserControl Array

12. generate dynamic barcodes as images on my page

 

 
Powered by phpBB® Forum Software