document.getEle mentById('util_ overview').inne rHTML = "";
9 1397
Attempt to find an HTML element on the page with an id value of "util_overv iew" and set the content between the tags to an empty string.
For example, say you had an HTML page with this: -
<div id="util_overview">
-
<div id="some_other_div">
-
This is some random text
-
</div>
-
</div>
-
What you'd end up with, would be this: -
<div id="util_overview"></div>
-
gits 5,390
Recognized Expert Moderator Expert
this wipes out the nodes that the node with the id='util_overvi ew' would contain ...
kind regards
PS: ahh ... one second late :)
If you want to change the contents of a particular div, the code you posted will do the job. Just assign some new, valid HTML to the innerHTML property instead of an empty string.
Of course, you'll need a way of initiating the change, such as wiring up your JS function to an event.
@nukefusion - /* -------------------------- */
-
/* INSERT VACATION */
-
/* -------------------------- */
-
/* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
-
-
-
nocache = 0;
-
progress_bar = new Image();
-
progress_bar.src = '../HRManagement/images/ajax-loader.gif';
-
-
-
function success_handler(o) {
-
replace_html('leaveinserting', o.responseText);
-
}
-
-
function failure_handler(o) {
-
replace_html('leaveinserting', 'Server or your connection is death');
-
}
-
function replace_html(id, leaveinserting) {
-
document.getElementById(id).innerHTML = leaveinserting;
-
}
-
function show_progressbar(leaveinserting) {
-
replace_html(leaveinserting, '<img src="/HRManagement/images/ajax-loader.gif" border="0" alt="Loading, please wait..." />');
-
}
-
function insert(Divid,emp,req,type,start,end,total,clr) {
-
-
-
alert("Inside the script");
-
alert("progressbar");
-
show_progressbar('leaveinserting');
-
-
alert("DivID :"+Divid)
-
alert("emp :"+emp)
-
alert("req :"+req)
-
alert("type :"+type)
-
alert("start :"+start)
-
alert("end :"+end)
-
alert("total :"+total)
-
alert("clr:"+ clr)
-
-
-
-
var Divid = Divid;
-
var emp = emp;
-
var req = req;
-
var type = type;
-
var start = start;
-
var end = end;
-
var total = total;
-
var sta = "E";
-
-
-
//document.getElementById('leaveinserting').innerHTML = "Just a Second... ";
-
-
nocache = Math.random();
-
alert("nocache="+nocache)
-
-
//alert("progressbar");
-
//show_progressbar('inserting');
-
//var callback = { success:success_handler, failure:failure_handler, timeout: 10000 };
-
-
searchReq.open('get','leaveinsert.jsp?EMPLOYEE_LEAVE.EMPLOYEE_ID='+emp+'&EMPLOYEE_LEAVE.REQUEST_DATE='+req+'&EMPLOYEE_LEAVE.LEAVE_TYPE='+type+'&EMPLOYEE_LEAVE.START_DATE='+start+'&EMPLOYEE_LEAVE.END_DATE='+end+'&EMPLOYEE_LEAVE.TOTAL_DAYS='+total+'&EMPLOYEE_LEAVE.STATUS='+sta+'&mode=insert');
-
//searchReq.open('get','employeeleaveoverview.jsp?EMPLOYEE_LEAVE.EMPLOYEE_ID='+emp+'&EMPLOYEE_LEAVE.REQUEST_DATE='+req+'&EMPLOYEE_LEAVE.LEAVE_TYPE='+type+'&EMPLOYEE_LEAVE.START_DATE='+start+'&EMPLOYEE_LEAVE.END_DATE='+end+'&EMPLOYEE_LEAVE.TOTAL_DAYS='+total+'&EMPLOYEE_LEAVE.STATUS='+sta+'&mode=insert');
-
-
-
searchReq.onreadystatechange = insertleaveReply;
-
searchReq.send(null);
-
//form.reset();
-
}
-
-
function insertleaveReply() {
-
if(searchReq.readyState == 4){
-
var response = searchReq.responseText;
-
-
-
// else if login is ok show a message: "Site added+ site URL".
-
document.getElementById('leaveinserting').innerHTML = 'Inserted'+response;
-
document.getElementById('clearing').innerHTML = "";
-
alert("Response"+ responseText);
-
document.getElementById('leaveinserting').innerHTML = responseText;
-
}
-
-
}
@nukefusion
i have the two div in a same page.first div having list.second div having inserting ethod.after inserting the recod have to refresh the first div. how to refresh the first div?
Well, presumably, within your second div you will have some sort of input field and a button. You could wire up a JS function to the buttons click event and using it add the input field content to your first div. Using the getElementById method you could do something like this for example:
HTML: -
<div id="div1">
-
-
</div>
-
<div id="div2">
-
<textarea name="data" rows="3"></textarea>
-
<input type="button" value="Add to div1" onclick="addToDiv1()" />
-
</div>
-
javascript : -
<script type="text/javascript">
-
function addToDiv1() {
-
var div1 = document.getElementById("div1");
-
div1.innerHTML = document.getElementById("data").value;
-
}
-
</script>
-
I haven't got time to test this code right now but the prinicipal is there. If I've understood your question properly then you can easily adapt this to achieve the result you're after.
Hope this helps.
I have a jsp page in which ther r 2 divs.
In the first one ,there is a list which gives the records inserted from the second div.
In the 2nd div,there r some textboxes.I got the value thr document.getEle mentbId
method and inserting the values thr ajax script.
On successful insertion of data into the table,the first div should be refreshed
showing recent added records and the second div data should be cleared or reset.
can give me any suggestion in solving the problem. Document1.txt
*****hereby attached the ajax script for inserting the values.
Without the associated html it's hard to see how this all links up.
If you doing some work using AJAX you can add any code to refresh the div in the callback method (success_handle r). It looks like you've already got it setup to do something like this as it's already updating the "leaveinserting " div with the return value anyway.
I'm not quite sure what part of your process isn't working... it looks like all the ingredients are there.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Kelvin |
last post by:
Hi, there:
My question is, what if my text contains the tag in square bracket itself?
What will MSXML30.dll do with such situation?
Do I have to filter out these stuff before I save the XML file itself?
Kelvin
|
by: Xiangliang Meng |
last post by:
Hi.
void setValue(int n)
{
int size = getValueLength();
int buffer_p;
if (buffer_p)
{
....
|
by: Raj Sharma |
last post by:
Hai Guys,
I am new to the group well i have one doubt in my mind from a
long time, that what will be the Future of VC++, as full framework has
been now .NET so will it be easy to shift to C#, or Will C# provide
the flexiblity in terms of Programming?
Please Clear this,
Thanx in Advnc.
|
by: Anil |
last post by:
Question related to ASP.Net web application with .Net Framework 1.1. I am
using ADO.Net and ODBC namespace.
When the user clicks the process button I am doing database INSERT/UPDATRE..
activity and it will take 30 seconds to complete the database activity and
then the user will be redirected to different screen.
|
by: neilcancer |
last post by:
i come from china,and i'm sorry that my english is very poor.
now i'm studing data structure and i met some problem about c language.
could you tell me what will happen after i use free()? i mean once i
use free() on a pointer,what will the pointer points to ?
for example:
#include<stdio.h>
| |
by: Ravi |
last post by:
void main()
{
main();
}
int main()
{
main();
}
|
by: raghu |
last post by:
Hello
I have a doubt plz clarify that
#ifndef SYSTEM_H
#define SYSTEM_H
what will be the value of SYATEM_H after this #define statement and
before that statement.
Thanking you all
Bye
|
by: vimalankvk80 |
last post by:
what will happen, if we forget to return ostream referance ?
class A
{
Private:
int _a;
int _b;
|
by: active |
last post by:
If I install .NET Framework 3.0 what will happen to my VS2005 experience?
Will it automatically use 3.0?
Will I find new features available?
Will the VS doc be updated?
Thanks fir any info
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |