Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Variable Javascript to html


Message #1 by "Wes Bowen" <wjbowen@i...> on Wed, 21 Feb 2001 18:36:33
This works for me ..


<html>

<Script Language = Javascript>

//-- get form field value, do something write it back

function mvtemp() {

var temp = document.frm1.txtField1.value

temp = temp + "This is a th end."

document.frm1.txtField1.value = temp

return true;

}

</script>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<meta name="GENERATOR" content="Microsoft FrontPage 4.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<title>New Page 1</title>

</head>

<body>

<form Name = "frm1" >

<input type = "Text" Name = "txtField1" Value = "None">

<input type = "button" onClick = "mvtemp();">

</form>

</body>

</html>

----- Original Message -----
From: "Wes Bowen" <wjbowen@i...>
To: "javascript" <javascript@p...>
Sent: Thursday, February 22, 2001 3:36 PM
Subject: [javascript] RE: Variable Javascript to html


> This is more of what I am trying to do
> But it does not work?
>
> <HTML>
> <HEAD>
> <script>
>
> function MoveValue()
> {
> var test1 = eval(document.form1.text1.value);
> test1 = test1*2;
> document.form1.text2.value = test1;
> }
>
> </script>
> </HEAD>
> <BODY>
> <form name=form1 id=form1>
>
> <INPUT type="text" id=text1 name=text1><BR>
> <INPUT type="text" id=text2 name=text2>
> <P> </P>
> <INPUT type="button" value="Button" id=button1 name=button1
> LANGUAGE=javascript onclick='MoveValue()'>
>
> </form>
> </BODY>
> </HTML>
>
> >
> > This is a simple example but it does what you want.
> >
> > <HTML>
> > <HEAD>
> > <script>
> >
> > function MoveValue()
> > {
> > var test1 = new String("I am in a text box");
> > document.form1.text1.value = test1;
> > }
> >
> > </script>
> > </HEAD>
> > <BODY>
> > <form name=form1 id=form1>
> >
> > <INPUT type="text" id=text1 name=text1>
> > <P> </P>
> > <INPUT type="button" value="Button" id=button1 name=button1
> > LANGUAGE=javascript onclick='MoveValue()'>
> >
> > </form>
> > </BODY>
> > </HTML>
> >
>
>


  Return to Index