Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #28498

Re: short script -- what is wrong?

Newsgroups comp.lang.javascript
Subject Re: short script -- what is wrong?
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <103306d5-085e-41c7-950a-fcf3edfcd430@googlegroups.com> <cd7e2f92-c7e5-4e34-a2c3-8328fbf832d4@googlegroups.com>
Date 2015-08-04 15:20 +0200
Message-ID <XnsA4EC9C159C56Beejj99@194.109.6.166> (permalink)

Show all headers | View raw


Jay Braun <lyngwyst@gmail.com> wrote on 04 Aug 2015 in
comp.lang.javascript: 

> I wanted to run the recommended script at: 
> 
> <http://solvedstack.com/questions/javascript-createelement>
> 
> which has:
> 
> <head>
>    <style>
>       ...
>    </style>
>    <script> 
>       ...
>    </script>
> </head>
> <body>
> </body>
> 
> So I simply added, on top:
> 
> <?xml version="1.0" standalone="no"?>
> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
>  "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
> <svg version="1.0" xmlns="http://www.w3.org/2000/svg">

Noooo !

> and on the bottom:
> 
> </svg>
> 
> Nothing happens when I double-click the svg file.  I am running on a
> Macintosh and my default browser os Firefox. 

Don't add those ugly headers,
and don't put the Javascript inside <svg>
<javascript> especially onload-functions,
belong in the <head>.

Just, as I suggested:

Add just <!DOCTYPE HTML> to the top.

Then run the Javascript as provided in the <head>

The <body> can remain empty, 
[or absent as it will be generated then]

If you hit F12 [tested Chrome, Firefox, Edge]
you can see the body will be filled by 
code like you provided.

TESTING HERE [Chrome, Firefox, Edge]:
<http://hannivoort.org/test/svgtest.asp>
<view-source:hannivoort.org/test/svgtest.asp>

[view-source: does not work in MS-Edge]

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

short script -- what is wrong? Jay Braun <lyngwyst@gmail.com> - 2015-08-03 20:02 -0700
  Re: short script -- what is wrong? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-08-04 11:17 +0200
  Re: short script -- what is wrong? Martin Honnen <mahotrash@yahoo.de> - 2015-08-04 11:19 +0200
  Re: short script -- what is wrong? Jay Braun <lyngwyst@gmail.com> - 2015-08-04 05:35 -0700
  Re: short script -- what is wrong? Jay Braun <lyngwyst@gmail.com> - 2015-08-04 06:00 -0700
    Re: short script -- what is wrong? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-08-04 15:20 +0200
      Re: short script -- what is wrong? Jay Braun <lyngwyst@gmail.com> - 2015-08-04 06:45 -0700
        Re: short script -- what is wrong? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-08-04 15:59 +0200

csiph-web