Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #22910 > unrolled thread
| Started by | jcharth@gmail.com |
|---|---|
| First post | 2014-01-31 08:54 -0800 |
| Last post | 2014-02-07 21:10 +0100 |
| Articles | 7 — 3 participants |
Back to article view | Back to comp.lang.javascript
can i paste java script in to a div? jcharth@gmail.com - 2014-01-31 08:54 -0800
Re: can i paste java script in to a div? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-01-31 18:21 +0100
Re: can i paste java script in to a div? jcharth@gmail.com - 2014-01-31 10:25 -0800
Re: can i paste java script in to a div? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-31 19:34 +0100
Re: can i paste java script in to a div? Christoph Michael Becker <cmbecker69@arcor.de> - 2014-01-31 19:35 +0100
Re: can i paste java script in to a div? jcharth@gmail.com - 2014-02-07 08:03 -0800
Re: can i paste java script in to a div? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-02-07 21:10 +0100
| From | jcharth@gmail.com |
|---|---|
| Date | 2014-01-31 08:54 -0800 |
| Subject | can i paste java script in to a div? |
| Message-ID | <7e9fdcbf-198d-4e10-96e8-42e8eff38ab7@googlegroups.com> |
Hello I have a script that grabs a piece of code (widget) from my database and I puts the code in the page with
document.getElementById('mdiv').innerHTML = strVALUE;
but it does not work. I dont think it can work. Is there a way to do this?
[toc] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-01-31 18:21 +0100 |
| Message-ID | <XnsA2C6BAAC3F5A7eejj99@194.109.133.133> |
| In reply to | #22910 |
jcharth@gmail.com wrote on 31 jan 2014 in comp.lang.javascript:
> Subject: can i paste java script in to a div?
There is no java script, as java does not have a scripting form.
And if there where it wwould still be off topic on this NG.
Perhaps you mean javascript?
[I leave it to PE to argue that there is no javascript either.]
> Hello I have a script that grabs a piece of code (widget) from my
> database and I puts the code in the page with
>
> document.getElementById('mdiv').innerHTML = strVALUE;
>
> but it does not work. I dont think it can work.
Never use innerHTML for anything else than inserting plain text, unless you
know EXACTLY what you are doing, and that on all target browsers.
Where is that database located? On the server?
> Is there a way to do this?
If it is legal javascript, like jason,
as a string in a variable,
you can just execute it using eval(codeString);.
Remember that eval is evil, so also here, you are warned.
Do NOT use jquery when you want to discuss such here.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [next] | [standalone]
| From | jcharth@gmail.com |
|---|---|
| Date | 2014-01-31 10:25 -0800 |
| Message-ID | <faa2eba7-8ab5-42c0-88ee-5c415f26ef88@googlegroups.com> |
| In reply to | #22910 |
Thanks. it is javascript but it is followed by a <DIV> so I dont think I can just paste it with javascript. I might have to use an iframe or something else.
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2014-01-31 19:34 +0100 |
| Message-ID | <52ebec9e$0$6657$9b4e6d93@newsspool2.arcor-online.net> |
| In reply to | #22913 |
jcharth@gmail.com wrote: > Thanks. it is javascript but it is followed by a <DIV> so I dont > think I can just paste it with javascript. I might have to use an > iframe or something else. Is it really JavaScript followed by a DIV element, or is it a SCRIPT element followed by a DIV element? I assume the latter, in which case it would be (X)HTML. -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2014-01-31 19:35 +0100 |
| Message-ID | <52ebecf1$0$6657$9b4e6d93@newsspool2.arcor-online.net> |
| In reply to | #22914 |
Christoph Michael Becker wrote: > jcharth@gmail.com wrote: > >> Thanks. it is javascript but it is followed by a <DIV> so I dont >> think I can just paste it with javascript. I might have to use an >> iframe or something else. > > Is it really JavaScript followed by a DIV element, or is it a SCRIPT > element followed by a DIV element? I assume the latter, in which case > it would be (X)HTML. ... an (X)HTML document fragment, I mean. -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | jcharth@gmail.com |
|---|---|
| Date | 2014-02-07 08:03 -0800 |
| Message-ID | <85e0a365-f772-41dc-9c37-ffbca91a18b7@googlegroups.com> |
| In reply to | #22915 |
I was trying to fetch the javascript code from a page and then put it to work inside a dive. Looks like the better approach read the code from the page and use docuemnt.write to make it execute. But not luck yet.
[toc] | [prev] | [next] | [standalone]
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
|---|---|
| Date | 2014-02-07 21:10 +0100 |
| Message-ID | <XnsA2CDD76127B3Ceejj99@194.109.133.133> |
| In reply to | #23024 |
jcharth@gmail.com wrote on 07 feb 2014 in comp.lang.javascript:
> Re: can i paste java script
There is no java script, as java has no scripting version.
According to PE there also is no javascript,
but you can ignore that in the context of your Q.
Javascript, the language, cannot be executed,
javascript script, the command script, can.
> I was trying to fetch the javascript code from a page and then put it
> to work inside a dive. Looks like the better approach read the code from
> the page and use docuemnt.write to make it execute. But not luck yet.
Once a page is finished/loaded,
you should not use document.write() [unless you want the following],
because it generates an implicit document.open()
and the page will be rewritten from scratch,
overwriting everything that existed on that
INCLUDING any Javascript <script> elements on that page.
Once a page is finished/loaded,
you should manipulate the DOM to add/change/delete something.
Once a page is finished/loaded,
you cannot let javascript "work inside a div",
you can with javascript script change what is inside a DOM-element
that has a "div" tagname.
However, during the loading of a page,
you can use a html-stream like this:
<div>
<script type='text/javascript'>
document.write('jcharth@gmail.com');
</script>
</div>
I do not understand what you mean by "fetch the javascript code",
and what is a "dive" other than a way of jumping into the deep?
Please use a decent signature on Usenet.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web