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.

using javascript to write to same html page

19
Javascript and html form question...

I created a html page with a form called MyForm

I enter values X and Y into MyForm

For onclick, I reference a function in the header called GetCoord() that is supposed to print X and Y. I don't want X and Y to be printed out in an alert window. I don't want to create a new webpage that would display X and Y. I don't want to use frames.

Instead I want my html page to update itself automatically. So after submitting MyForm, I want the form to stay there and for the webpage to be udpated by printing out X and Y.

Is this possible?
Aug 4 '06 #1
5 11051
sanou
19
Maybe this is involves some sort of dynamic update?
Aug 4 '06 #2
jay_dev
10
sure it is use a div tag
first it shouldbe hidden then when you're ready to print what you want
put it inside it then show it
Some Code
<div id='div1' style="display:none"></div>
when X and Y are to be printed
you should call a javascript function to do that as follows

function printXY()
{

document.getElementById('div1').innerHTML=' what you want to print'
document.getElementById('div1').style.display='blo ck'
}
Aug 4 '06 #3
you can also use document.write(). if the writing is being done by a dynamically allocated object, the writing will happen in the space that it was allocated in, else it will be appended to the document.
Aug 4 '06 #4
sure it is use a div tag
first it shouldbe hidden then when you're ready to print what you want
put it inside it then show it
Some Code
<div id='div1' style="display:none"></div>
when X and Y are to be printed
you should call a javascript function to do that as follows

function printXY()
{

document.getElementById('div1').innerHTML=' what you want to print'
document.getElementById('div1').style.display='blo ck'
}



thanx
ur help is realy appreciable..

ajay
Jan 13 '07 #5
pyrao
1
<!DOCTYPE html>
<head>
<link href="bootstrap-3.0.0/dist/css/bootstrap.min.css" rel="stylesheet">
<script>
function val1(){

var name1=document.getElementById('name').value;
var class1=document.getElementById('clas').value;
var age1=document.getElementById('age').value;
document.getElementById('disp').style.display='blo ck'

document.getElementById('n').innerHTML= name1;
document.getElementById('c').innerHTML=class1;
document.getElementById("a").innerHTML=age1;

}

</script>
</head>

<body>
<form class="container" >
<div class="form-group ">
<div class="row">
<div class="col-md-1 col-md-offset-1">
<label class="label-control" >name</label>
</div>
<div class="col-md-8">
<input type="text" class="form-control" id="name">
</div>
</div>

</div>
<div class="form-group form-inline">
<div class="row">
<div class="col-md-1 col-md-offset-1">
<label >class</label>
</div>
<div class="col-md-8 ">
<input type="text" class="form-control" id="clas">
</div>
</div>
</div>
<div class="form-group form-inline">
<div class="row">
<div class="col-md-1 col-md-offset-1">
<label >age</label>
</div>
<div class="col-md-8">
<input type="text" class="form-control" id="age">
</div>
</div>
</div>
<div class="form-group form-inline">
<div class="row">
<button type="submit" class="btn btn-warning btn-block" onclick= "val1()">submit</button>
</div>
</div>
</form>

<div class="well well-sm" id="disp" style="display:none;">
<p id="n"></p><br>
<p id="c"></p><br>
<p id="a"></p><br>

</div>

</body>








thisismycode todispaly the elements. but if i click submit button the text blinks once.The text has to be displyed.
Sep 22 '13 #6

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

Similar topics

12
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the...
1
by: Scott Navarre | last post by:
Hello, I have noticed that when using JavaScript to create a page, the sizes of the text input form elements come out bigger than the size I am trying to set them to. I don't know if it...
9
by: Charley Kyd | last post by:
I'm a newbie who needs advice about how to use external files of JavaScript code. I spent an hour this afternoon browsing through JavaScript books at the local book store. In about 15 different...
1
by: jon | last post by:
I would like to use the variable that the javascript creates as it parses the URL and be able to use this variable in other links on the same page. notice how link to page 2 has the token but the...
26
by: Don | last post by:
I'm writing an html page with some JavaScript that reads a web page into a client-side temp file, then reformats it, then submits that same file as a URL to the browser for display, via...
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.