By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,066 Members | 1,841 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,066 IT Pros & Developers. It's quick & easy.

embedding html in a javascript function

P: n/a
hello,

i want to put some html into my javascript function. how do i
accomplish a task like that? thanks!

rick

Jan 17 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Rick wrote on 17 jan 2006 in comp.lang.javascript:
i want to put some html into my javascript function. how do i
accomplish a task like that? thanks!


Why do you ask?

document.write('<br>');

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jan 17 '06 #2

P: n/a
"Rick" <RS********@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.com...
hello,

i want to put some html into my javascript function. how do i
accomplish a task like that? thanks!

rick


"put some html into my javascript function" -- huh?

What function? What HTML? Perhaps this:

<html>
<head>
<title>somehtml.htm</title>
</head>
<body>
<script type="text/javascript">
document.write("<b>Hello World</b>");
</script>
</body>
</html>

If not then you'll need to elaborate.
Jan 17 '06 #3

P: n/a
well...i want to put some .asp code into my javascript function. i
have a function that, when the user presses a button, generates three
text boxes, and i want to add some asp code to that function so that i
can write the user inputted data over to my database. any suggestions?

Jan 17 '06 #4

P: n/a
Rick wrote:
well...i want to put some .asp code into my javascript function. i
have a function that, when the user presses a button, generates three
text boxes, and i want to add some asp code to that function so that i
can write the user inputted data over to my database. any suggestions?


Short answer is: You can't.

1. The browser makes an HTTP request
2. The server executes the ASP and generates an HTTP response
3. The browser recieves the HTTP response and parses the HTML, executing any
JavaScript it finds.

To send data from the browser back to the server to process that data with
ASP requires another HTTP request. This is typically done by directing the
browser to a new URL. Another option is the XMLHttpRequest object.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jan 17 '06 #5

P: n/a
"Rick" <RS********@gmail.com> wrote:
well...i want to put some .asp code into my javascript function. i
have a function that, when the user presses a button, generates three
text boxes, and i want to add some asp code to that function so that i
can write the user inputted data over to my database. any suggestions?


ASP code is executed on the server. That results in HTML, which is
sent to the client and displayed in the client's browser. Javascript
then runs on the browser. (This is the normal scenario, ASP is a
platform for which code can be written in VBScript, Javascript< or
other languages). In this case, having your Javascript function write
ASP code is meaningless. The way to get data from the client to your
DB is to submit a page, or use AJAX.

--
Tim Slattery
Sl********@bls.gov
Jan 17 '06 #6

P: n/a
yikes...so if i want to be have the user be able to write in a user
defined number of text boxes dynamically...i cant use javascript?

Jan 17 '06 #7

P: n/a
Rick wrote:

Are you responding to something?

http://www.safalra.com/special/googlegroupsreply/
http://oakroadsystems.com/genl/unice.htm#quote
yikes...so if i want to be have the user be able to write in a user
defined number of text boxes dynamically...i cant use javascript?


Yes can, but you should include a server side fallback, and you need to
write ASP capable of handling a variable number of inputs (as opposed to
changing the ASP with JavaScript, which isn't possible).

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jan 17 '06 #8

P: n/a
Tim Slattery wrote:
[...] ASP is a platform for which code can be written in
VBScript, Javascript< or other languages). [...]


Not Javascript, only JScript. A fine but important difference.
PointedEars
Jan 17 '06 #9

P: n/a
On 2006-01-17, Rick <RS********@gmail.com> wrote:
well...i want to put some .asp code into my javascript function. i
have a function that, when the user presses a button, generates three
text boxes, and i want to add some asp code to that function so that i
can write the user inputted data over to my database. any suggestions?


This newsgroup has an excellent Faq.

Bye.
Jasen
Jan 18 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.