Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Insert javascript variable value in body of HTML page

Reply
Thread Tools

Insert javascript variable value in body of HTML page

 
 
keerthana_m_2003@yahoo.com
Guest
Posts: n/a
 
      10-18-2005
Hello:

is it possible to insert the value of some JavaScript variable in the
body of HTML (for example the text on button, or at any part of the
HTML text part). Please tell me how to do this.

Thanks

 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      10-18-2005

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> is it possible to insert the value of some
> JavaScript variable in the body of HTML
> (for example the text on button


<script type="text/javascript">
function myFunction() {
document.forms[0].elements[0].value = 'Custom text';
// or:
// document.myForm.button001.value = 'Custom text';
// which does the same
}
</script>
<body onload="myFunction()">
....
<form name="myForm">
<input type="button" name="button001" value="Default text">
</form>
....

> , or at any part of the HTML text part).


To *change* the content of a text block see
<http://www.jibbering.com/faq/#FAQ4_15> and related links.

To *insert/replace* some text of a text block, you need to use
TextRange
object
<http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/objects/obj_textrange.asp>
but it flyes as expected for IE only.
For other browser you need to use different legacy tricks. As these
tricks are numerous and their set/implementation depends heavily on
current tack, more clarification of your actual aim would be helpful.

 
Reply With Quote
 
 
 
 
Gomolyako Eduard
Guest
Posts: n/a
 
      10-18-2005
See "InnerText" & "InnerHTML" properties for HTML objects and "value"
property for forms inputs.

Best, Ed.

 
Reply With Quote
 
Mick White
Guest
Posts: n/a
 
      10-18-2005
Gomolyako Eduard wrote:

> See "InnerText" & "InnerHTML" properties for HTML objects and "value"
> property for forms inputs.
>
> Best, Ed.
>

InnerText ? perhaps you mean: "innerText"?
The former doesn't exist, and the latter is unreliable(IE invention).
Mick
 
Reply With Quote
 
Gomolyako Eduard
Guest
Posts: n/a
 
      10-18-2005
Mick White писал(а):

> Gomolyako Eduard wrote:
>
> > See "InnerText" & "InnerHTML" properties for HTML objects and "value"
> > property for forms inputs.
> >
> > Best, Ed.
> >

> InnerText ? perhaps you mean: "innerText"?


Yes, u right, i mean "innerText".

> The former doesn't exist, and the latter is unreliable(IE invention).


Thx.

> Mick


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Where to put javascript in the HTML page? Header or body? Nasser M. Abbasi Javascript 3 04-03-2010 07:31 PM
Insert an HTML newsletter in the body of an email johnny15 HTML 3 05-18-2007 10:21 AM
How to read the BODY of HTML file from another HTML file using javascript? Dhanasankar S via DotNetMonster.com ASP .Net 1 02-28-2005 05:51 PM
How to read the BODY of HTML file from another HTML file using javascript? Dhanasankar S via DotNetMonster.com ASP .Net 0 02-26-2005 10:58 AM
How to insert dynamically generated HTML into the <body> of an ASP.NET page? Rick Spiewak ASP .Net 5 08-01-2003 12:23 PM



Advertisments