473,387 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Dynamically insert javascript statements

Hi,
Is There any way to insert a jascript statements into a script tag which is created dynamically.

i.e like ("tagName").innerHTML = string. Is there any way for the script tag.


Thaks in advance for your reply.
Jun 18 '07 #1
6 1671
gits
5,390 Expert Mod 4TB
hi ...

i think it should be possible, you may set the innerHTML of every document-node ... but its a really strange thing ... for what reason you want to do that?

kind regards ...
Jun 18 '07 #2
epots9
1,351 Expert 1GB
i think i would be something along these lines:
Expand|Select|Wrap|Line Numbers
  1. var link = document.createElement('a');
  2. link.setAttribute('onclick', 'function()');
  3.  
good luck
Jun 18 '07 #3
gits
5,390 Expert Mod 4TB
yep ... something that makes sense ... that assigns an event-handling to a document node ... but i'm still wondering what might be the purpose of setting the innerHTML of a dynamically created script-tag? may be i misunderstood the question ... but it might be to create an entire new document through javascript? ...
Jun 18 '07 #4
epots9
1,351 Expert 1GB
when i read it, i thought it was asking for the ablitly to add attributes to dynamically created elements.
Jun 18 '07 #5
gits
5,390 Expert Mod 4TB
that might be ... may be i was confused by the term 'script'-tag ;) ...
Jun 19 '07 #6
that might be ... may be i was confused by the term 'script'-tag ;) ...
hi,
epots9 was right. I need to insert a block of stmts into the created tag.

It works well with .innerHTML

I need one more info:
As i was googling i found in w3.org

it says node.data = the srting etc.... OR node.data gives the text or data inside the node.

I tried that but it dosent work any suggestions.

thanks in advance for your reply.
----- Looking Forward
Jun 20 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: john_williams_800 | last post by:
Hi; I am just starting to use the DOM to do some more advanced javascripting so please be patient with my question if it is an ignorant question. I would like to use the DOM to dynamically...
16
by: Philip Boonzaaier | last post by:
I want to be able to generate SQL statements that will go through a list of data, effectively row by row, enquire on the database if this exists in the selected table- If it exists, then the colums...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
6
by: Lelle | last post by:
Hello ! how can i insert text containg code examples from a textbox into a database using SQL insert statment. i have no problem to just add text that dont contains code and script examples...
4
by: Jaime Stuardo | last post by:
Hi all... I need to add some JavaScript code that is dynamically generated to some point of the page. Currently I'm using ClientScript.RegisterStartupScript(GetType(), "menu", "<script...
6
by: Smugsboy | last post by:
Need some help. I would like to create in my site a picture that when a user clicks on it, a javascript code which determines which file is to be downloaded to the user, is ran. My problem is...
1
by: satish | last post by:
Hi, How do I run dynamic sql statements in side a UDF? Is there any work around to retrieve data that way? Example: -- Table create table dataTbl (col1 varchar(5),col2...
3
by: Dmitri | last post by:
Hello! I have a developer that is playing around with some SQL statements using VB.NET. He has a test table in a SQL 2000 database, and he has about 2000 generated INSERT statements. When the...
1
by: andyr | last post by:
I would like to dynamically insert a javascript call with with data retrived from the database. All I am trying to do is dynamically inserting the following <script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.