Dynamically adding new <script> element (2)

View: New views
2 Messages — Rating Filter:   Alert me  

Dynamically adding new <script> element (2)

by ccoroom :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I have another form of error when I tried to create a new <script> element dynamically.

HtmlUnit cannot create a new <script> element that defines variable message.
This problem occurs with all types of browsers: IE6, IE7, and FF2.

I'm working with HtmlUnit 2.2 snapshot with forked version of Rhino(2.2 Snapshop).

Here's my code:
----
<html>
<head>
        <script type="text/javascript" src="./add.js"></script>
        <script type="text/javascript">
                add();
        </script>
</head>
<body>
        <input type="button" value="hello" onclick="alert(message);"/>
</body>
</html>
----
//add.js
function add() {
        return document.writeln('\t<script type="text/javascript" src="./hello.js"></script>');
}
----
//hello.js
var message ='hi, there!';
----

Regards,
Sung-Ahn Kim.

Re: Dynamically adding new <script> element (2)

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Can you create a bug report with this information? Otherwise it's likely to get lost ;-)
 
Thanks!
 
Daniel


 
On Thu, Jul 3, 2008 at 7:58 AM, ccoroom <ccoroom@...> wrote:

Hi,
I have another form of error when I tried to create a new <script> element
dynamically.

HtmlUnit cannot create a new <script> element that defines variable message.
This problem occurs with all types of browsers: IE6, IE7, and FF2.

I'm working with HtmlUnit 2.2 snapshot with forked version of Rhino(2.2
Snapshop).

Here's my code:
----
<html>
<head>
       <script type="text/javascript" src="./add.js"></script>
       <script type="text/javascript">
               add();
       </script>
</head>
<body>
       <input type="button" value="hello" onclick="alert(message);"/>
</body>
</html>
----
//add.js
function add() {
       return document.writeln('\t<script type="text/javascript"
src="./hello.js"></script>');
}
----
//hello.js
var message ='hi, there!';
----

Regards,
Sung-Ahn Kim.
--
View this message in context: http://www.nabble.com/Dynamically-adding-new-%3Cscript%3E-element-%282%29-tp18257629p18257629.html
Sent from the HtmlUnit - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user



--
Daniel Gredler
http://daniel.gredler.net/
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user
LightInTheBox - Buy quality products at wholesale price