473,654 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

what will this do?

19 New Member
document.getEle mentById('util_ overview').inne rHTML = "";
May 21 '10 #1
9 1397
nukefusion
221 Recognized Expert New Member
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:

Expand|Select|Wrap|Line Numbers
  1. <div id="util_overview">
  2.     <div id="some_other_div">
  3.         This is some random text
  4.     </div>
  5. </div>
  6.  
What you'd end up with, would be this:

Expand|Select|Wrap|Line Numbers
  1. <div id="util_overview"></div>
  2.  
May 21 '10 #2
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 :)
May 21 '10 #3
techuse
19 New Member
@nukefusion
how can i refresh a particular div?
May 21 '10 #4
nukefusion
221 Recognized Expert New Member
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.
May 21 '10 #5
techuse
19 New Member
@nukefusion
Expand|Select|Wrap|Line Numbers
  1. /* -------------------------- */
  2. /* INSERT VACATION */
  3. /* -------------------------- */
  4. /* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
  5.  
  6.  
  7.  nocache = 0;
  8.  progress_bar = new Image();
  9. progress_bar.src = '../HRManagement/images/ajax-loader.gif';
  10.  
  11.  
  12. function success_handler(o) {
  13.   replace_html('leaveinserting', o.responseText);
  14.         }
  15.  
  16.         function failure_handler(o) {
  17.             replace_html('leaveinserting', 'Server or your connection is death');
  18.         }
  19.            function replace_html(id, leaveinserting) {
  20.         document.getElementById(id).innerHTML = leaveinserting;
  21.         }
  22.         function show_progressbar(leaveinserting) {
  23. replace_html(leaveinserting, '<img src="/HRManagement/images/ajax-loader.gif" border="0" alt="Loading, please wait..." />');
  24.         }
  25. function insert(Divid,emp,req,type,start,end,total,clr) {
  26.  
  27.  
  28.     alert("Inside the script");
  29.     alert("progressbar");
  30.     show_progressbar('leaveinserting');
  31.  
  32.     alert("DivID :"+Divid)
  33.     alert("emp :"+emp)
  34.     alert("req  :"+req)
  35.     alert("type :"+type)
  36.     alert("start :"+start)
  37.     alert("end :"+end)
  38.     alert("total :"+total)
  39.     alert("clr:"+ clr)
  40.  
  41.  
  42.  
  43. var Divid = Divid;
  44. var emp  = emp;
  45. var req  = req;
  46. var type = type;
  47. var start = start;
  48. var end = end;
  49. var total = total;
  50. var sta = "E";
  51.  
  52.  
  53. //document.getElementById('leaveinserting').innerHTML = "Just a Second... ";
  54.  
  55. nocache = Math.random();
  56. alert("nocache="+nocache)
  57.  
  58. //alert("progressbar");
  59. //show_progressbar('inserting');
  60. //var callback = { success:success_handler,    failure:failure_handler, timeout: 10000 };
  61.  
  62. 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');
  63. //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');
  64.  
  65.  
  66. searchReq.onreadystatechange = insertleaveReply;
  67. searchReq.send(null);
  68. //form.reset();
  69. }
  70.  
  71. function insertleaveReply() {
  72. if(searchReq.readyState == 4){
  73. var response = searchReq.responseText;
  74.  
  75.  
  76. // else if login is ok show a message: "Site added+ site URL".
  77. document.getElementById('leaveinserting').innerHTML = 'Inserted'+response;
  78. document.getElementById('clearing').innerHTML = "";
  79. alert("Response"+ responseText);
  80. document.getElementById('leaveinserting').innerHTML = responseText;
  81. }
  82.  
  83. }
May 21 '10 #6
techuse
19 New Member
@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?
May 21 '10 #7
nukefusion
221 Recognized Expert New Member
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:

Expand|Select|Wrap|Line Numbers
  1. <div id="div1">
  2.  
  3. </div>
  4. <div id="div2">
  5.     <textarea name="data" rows="3"></textarea>
  6.     <input type="button" value="Add to div1" onclick="addToDiv1()" />
  7. </div>
  8.  
javascript:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.     function addToDiv1() {
  3.         var div1 = document.getElementById("div1");
  4.         div1.innerHTML = document.getElementById("data").value; 
  5.     }
  6. </script>
  7.  
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.
May 21 '10 #8
techuse
19 New Member
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.
May 21 '10 #9
nukefusion
221 Recognized Expert New Member
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.
May 21 '10 #10

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

Similar topics

3
1485
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
18
2935
by: Xiangliang Meng | last post by:
Hi. void setValue(int n) { int size = getValueLength(); int buffer_p; if (buffer_p) { ....
5
1851
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.
4
1352
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.
67
3770
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>
17
6792
by: Ravi | last post by:
void main() { main(); } int main() { main(); }
14
2434
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
3
1708
by: vimalankvk80 | last post by:
what will happen, if we forget to return ostream referance ? class A { Private: int _a; int _b;
11
1499
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
0
8379
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, 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...
0
8294
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,...
1
6162
isladogs
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...
0
5627
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();...
0
4150
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...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
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
1
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1597
bsmnconsultancy
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...

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.