:
: Alright, I have a textbox called "A" and the value in that textbox is "B".
: When the user presses submit I want A : B to appear on the page. How do I
: do it?
Hi Oli...
You do it on the client-side. If you do it on the server-side, then you go
back to the server or at the very least unnecessarily reload the page or
another page. If the user is involved, you're working with the client, not
the server. Unless you need anything from the server, it is better to do it
on the client-side. If you do need something from the server, then it is
best to do it when the page loads, if possible.
If this is for the Internet, then javascript would be the language of
choice. If on an intranet and the browser is IE, it could be
javascript/jscript or vbscript. Not having this information makes it hard
to supply code for a specific language.
More information needed is how you want the information displayed. Stating,
"I want A:B to appear on the page" is vague. The reason is document.write
would replace all information on a page.
<form id=form1 onSubmit="document.write(A.name+':'+A.value)">
<input id="A" name="A" value="" />
<input type=submit id=submit1 name=submit1 value="Submit">
</form>
Setting the value or the innerText/innerHTML of a tag could render the value
to be shown within the current page.
<label id=label1> </label><br />
<form id=form1 onSubmit="document.getElementById("label1").innerText
=A.name+':'+A.value; return false">
<input id="A" name="A" value="" />
<input type=submit id=submit1 name=submit1 value="Submit">
</form>
Since you didn't say the user inputs the value, it could already be there.
You could already have what you want to show hidden and when the user clicks
submit, reveal it.
<html>
<head>
<title></title>
<script type="text/javascript">
function fillLabel(a, b) {
document.getElementById('label1').innerText=a+":"+b;
}
</script>
</head>
<body
onload="fillLabel(document.getElementById('A').name,document.getElementById(
'A').value)">
<label id=label1 style="display: none"></label>
<form id=form1
onSubmit="document.getElementById('label1').style.display='block'; return
false">
<input id="A" name="A" value="B" />
<input type=submit id=submit1 name=submit1 value="Submit" />
</form>
</body>
</html>
Since this is not an ASP-related question, I have set the followups to:
microsoft.public.scripting.jscript
HTH...
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center -
http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library -
http://msdn.microsoft.com/library/default.asp