473,840 Members | 1,558 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 1407
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>
What you'd end up with, would be this:

Expand|Select|Wrap|Line Numbers
  1. <div id="util_overview"></div>
May 21 '10 #2
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
19 New Member
how can i refresh a particular div?
May 21 '10 #4
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
19 New Member
Expand|Select|Wrap|Line Numbers
  1. /* -------------------------- */
  3. /* -------------------------- */
  4. /* Required: var nocache is a random number to add to request. This value solve an Internet Explorer cache issue */
  7.  nocache = 0;
  8.  progress_bar = new Image();
  9. progress_bar.src = '../HRManagement/images/ajax-loader.gif';
  12. function success_handler(o) {
  13.   replace_html('leaveinserting', o.responseText);
  14.         }
  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) {
  28.     alert("Inside the script");
  29.     alert("progressbar");
  30.     show_progressbar('leaveinserting');
  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)
  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";
  53. //document.getElementById('leaveinserting').innerHTML = "Just a Second... ";
  55. nocache = Math.random();
  56. alert("nocache="+nocache)
  58. //alert("progressbar");
  59. //show_progressbar('inserting');
  60. //var callback = { success:success_handler,    failure:failure_handler, timeout: 10000 };
  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');
  66. searchReq.onreadystatechange = insertleaveReply;
  67. searchReq.send(null);
  68. //form.reset();
  69. }
  71. function insertleaveReply() {
  72. if(searchReq.readyState == 4){
  73. var response = searchReq.responseText;
  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. }
  83. }
May 21 '10 #6
19 New Member
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
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:


Expand|Select|Wrap|Line Numbers
  1. <div id="div1">
  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>

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>
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
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
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

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: 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: 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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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: 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: 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...

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.