JavaScript - Onload Func To Remove The Table To The Homepage Rendered From Diff Pages
Hi,
I am having a Main homepage in my site which contains many pages rendered from different sources. And all these rendered pages are having a table like <table id="toc" class="toc"></table> . As all these are rendered in my homepage , those tables are appearing in my homepage.. I am trying to remove these tables from my homepage coding by javascript. So i tried with a onload option to remove it .. But i dono how to do this. Since by any way only one table in the first page rendered is removed and all others are having the table.. How can i do this?? Please help me.. Similar TutorialsHello all, i am new to forum. I am working with a javascript for that I want to have the table disable when the page loads and enable only if the user checks the checkbox. Can anyone help me with this?-- here is my code <script type="text/javascript"> function hideshow(){ var cells=document.getElementById('tab').getElementsByTagName('td'), i=0, c; var chb=document.getElementById('chboxes').getElementsByTagName('input'); while(c=cells[i++]){ c.style.display=chb[c.cellIndex].checked?'':'none'; } } function setEvent(){ var chb=document.getElementById('chboxes').getElementsByTagName('input'), i=0, c; while(c=chb[i++]){ if(c.type=='checkbox'){c.onclick=function(){hideshow()}} } } onload=setEvent; Thanks in advance http://www.docstoc.c/search/.net/?catfilter=1 insted of c use com You can see 3 images in the top left corner of a content page. When try to click that you can see a js function switchResultLayout('text') has been called and i want to know what would they have done to achive that with out page post back? Hello Can anyone help with the following problem On the following page http://www.stroudskittles.co.uk/signingon.html I have a Body onload event (to load the chained Menu) and a windows.onload event (to load the IFrame Ticker) If I open the page in Internet explorer both scripts function; however in Firefox I'm having problems. The Chained Menu works, however the IFrame Ticker does not display. Both events ahave ben placed on the boady tag. Can anyone advise how I can get both to display in Firefox Can anyone Hey everyone, I wanted to write my own script for a fade-in animation, since the ones I have found have got too many options or need some framework, which makes them unnecessarily big. I wanted to learn too. Unfortunately, the code didn't work as I wanted, and I commented some things so as to find out what's happening. The only function called from outside is fadeIn with a string as argument (in the example, this string is: d1296668690535). This is the code: Code: var fadems = 500; // Anim. duration in milliseconds var fps = 20; // Frames per second function fadeIn(elemId){ var frames = fadems/1000 * fps; var delay = 1000 / fps; var incrOp = 1 / frames; //document.getElementById(elemId).style.zoom = '1'; setOp(elemId, 0); for(i=1; i<=frames; i++){ debugOutLn("(fadeIn for) elemId = " + elemId); setTimeout("setOp(" + elemId + "," + incrOp*i + ")", delay*i); } } function setOp(elemId, val){ debugOutLn("(setOp) elemId = " + elemId + "; val = " + val); // document.getElementById(elemId).style.opacity = val; // document.getElementById(elemId).style.filter = 'alpha(opacity = ' + val * 100 + ')'; } Code: function debugOutLn(str){ document.getElementById("debug").innerHTML += str + "<br />"; } And this is the text it outputs (on Opera 11.01): Code: (setOp) elemId = d1296668690535; val = 0 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (fadeIn for) elemId = d1296668690535 (setOp) elemId = [object HTMLDivElement] ; val = 0.1 (setOp) elemId = [object HTMLDivElement] ; val = 0.2 (setOp) elemId = [object HTMLDivElement] ; val = 0.30000000000000004 (setOp) elemId = [object HTMLDivElement] ; val = 0.4 (setOp) elemId = [object HTMLDivElement] ; val = 0.5 (setOp) elemId = [object HTMLDivElement] ; val = 0.6000000000000001 (setOp) elemId = [object HTMLDivElement] ; val = 0.7 (setOp) elemId = [object HTMLDivElement] ; val = 0.8 (setOp) elemId = [object HTMLDivElement] ; val = 0.9 (setOp) elemId = [object HTMLDivElement] ; val = 1 Why is an object reference assigned to what was previously a string? Thanks for the help! I have some javascript <script type="text/javascript"> function loadGrid(x,y,z) { document.getElementById("feature").innerHTML='<br><center><b><font color=red face="times, times new roman, serif"><b></center>!Featured Products!</b><br></font><object width="600" height="600" type="text/html" data="./grid.php?offset='+x+'&feature='+y+'&category_id='+z+'" ></object>'; } </script> I just fill in a DIV with the contents of a php page in that code I write out a next previous buton print "<button onclick='loadgrid(1,1,%)'><img src=images/page_pics/".$p."></button><button onclick='loadgrid(1,21,%)'><img src=images/page_pics/".$n."></button>"; thats supposed to call the javascript above when clicked but it doesnt seem to work ...when the page is rendered into the DIV at client sould it be able to run the javascript above? <?PHP include('scripts/conf.php'); include('scripts/db_mysql.php'); $db_handle = mysql_connect(DB_HOST,DB_USERNAME,DB_PASSWORD); $db_found = mysql_select_db(DB_DATABASE, $db_handle); $ridx = 1; $cidx = 1; if ($db_found) { $SQL = "select * from tag_item where feature = ".$_GET["feature"]." and status = 1 and category_id like '".$_GET["category_id"]."' LIMIT 21 OFFSET " . $_GET["offset"] ; $result = mysql_query($SQL); $num_rows = mysql_num_rows($result); print "<table>"; while ( $db_field = mysql_fetch_assoc($result) ) { if ($cidx == 1 ) {print "<tr>";} print "<td width=90 style='border:solid 1px #000'>"; print "<center><img src='images/thumbs/" . $db_field["id"] . ".jpg'></center>"; print "</td>"; if($cidx == 3) {print "</tr>";} $cidx = $cidx + 1; if ($cidx == 4) { $cidx = 1; $ridx = $ridx + 1; } } print "</table>"; $p="prev.gif"; $n="next.gif"; if ($_GET["offset"] < 22) {$p="prevdis.gif";} if ($_GET["offset"] > $num_rows) {$n="nextdis.gif";} $newoffset = $_GET["offset"] + 21; print "<button onclick='loadgrid(1,1,%)'><img src=images/page_pics/".$p."></button><button onclick='loadgrid(1,21,%)'><img src=images/page_pics/".$n."></button>"; mysql_close($db_handle); } else { print "Database NOT Found "; mysql_close($db_handle); } ?> I try to get data from database and display them onto a div, after all messages are shown on the div, then only it will know the scrollheight of the div, it will auto scroll to the bottom of div as default by function asd(). My problem is when there are too many messages on database, it took very long time to display them all onto the div, so asd() executed before all messages are displayed. Meaning the scrollheight of the div is incorrect at this point, thus auto scroll to bottom is fail. Code: $(function() { showMsg(); asd(); }); How to wait until showMsg() finish render the contents before execute asd()? I havejQuery.get(); .append(); .replace(); .innerHTML inside showMsg(). The problem is fixed when I use timeout to execute asd() after 3 seconds : Code: $(function() { showMsg(); setTimeout(asd();, 3000); }); That's why I sure asd() is executed when showMsg() is not yet finish loaded the contents. I guess I know where is the problem. If showMsg() is executed BEFORE the DOM is ready, and if asd() is executed AFTER DOM is ready (at this point all messages are rendered already), so the problem is fix. But now my situation is AFTER the DOM is ready, all messages still not yet finish rendered, because showMsg() and asd() are executed only AFTER the DOM is ready. "executed" doesn't mean "finish rendered". My question is how to make sure showMsg() finish rendered the contents into a div before execute asd() ? I've tried using this to do it, but it isn't working... string.replace(/(<table([^>]+)table>)/ig,""); Hi, I have made this php script which checks two variables (nick and email): script.php PHP Code: <?php if (isset($_GET['nick'])) { $name = 'aurimas'; $ats = $_GET['nick']; if ($name == $ats) {echo "Užimtas";} else {echo "Laisvas";} } if (isset($_GET['email'])) { $email = 'auriaks@gmail.com'; $get_mail = $_GET['email']; if ($email == $get_mail) {echo "Užimtas";} else {echo "Laisvas";} } ?> And I use this Ajax script to get the answers from script.php PHP Code: // Get the HTTP Object function gethttpObject(){ if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); else if (window.XMLHttpRequest) return new XMLHttpRequest(); else { alert("Your browser does not support AJAX."); return null; } } // Change the value of the outputText field function setOutput(){ if(httpObject.readyState == 4){ document.getElementById('answer').innerHTML = httpObject.responseText; } } // Implement business logic function doWork(){ httpObject = gethttpObject(); if (httpObject != null) { httpObject.open("GET", "script.php?nick=" + document.getElementById('nikas').value + "&email=" + document.getElementById('email').value, true); httpObject.send(null); httpObject.onreadystatechange = setOutput; } } setInterval(doWork, 100); var httpObject = null; The problem is, that I want to get those answers in different places of the page. PHP Code: <div id='td'>Nikas* |Tik mažosios raidės|</div> <div id='td'><input MAXLENGTH=20 type="text" size='27' id='nikas' name="nick" value="<?php echo $_POST['nick']; ?>">ONE HERE(WORKS)<div id='answer'></div></div> <div id='td'>E-paštas*</div> <div id='td'><input MAXLENGTH=60 type="text" size='27' id="email" name="email" value="<?php echo $_POST['email']; ?>">ANOTHER HERE(DONT WORK)</div> taisyklėmis. The aim is to check if the nick and email already exists ant tell user this info by saying "užimtas"(exists) or "Laisvas"(available) THANKS in ADVANCE Hi Experts, I am sorry if this is a beat up question... I have a form with three fields that capture Amounts in $: Field1: Invoice_Amount (calculated using SQL Query from Invoice table - Display only) Field2: Amount_Paid - Will be entered by admin Field3: Amount_Due - Should be autocalculated based on Field1-Field2 I want to put an onChange event on Field2 so that when user tabs out of that field then Field3 is automatically calculated. Any help would be appreciated. Thanks Vinny I want to set www.google.com into IE home page,so I use following code: Code: <script language="javascript"> function abc(){ setHomePage("http://www.google.com"); } </script> When I run it under IE8,it raise javascript error: missing object Where is wrong? How to correct my code? Thanks Does any one have any ideas for javascript homepage apps
Hi, My site IE layout is messed up. is there a way to make a java neat screen before site loads showing "Optimised for FF and Chrome with some other text" The style similar to ( graying rest of screen groupon.de) Please help want to implement ASAP Regards Hi Folks, I've been trying to create a drag drop homepage like www.bbc.co.uk, google etc. I can get the basic drag and drop to work, but I can't get the layout to save anywhere. Can anyone please help? Here is what I have so far. http://www.sandwell.nhs.uk/test/test.html It uses Glow, which doesn't have any cookie functions apparantly. Could anyone please help me save my layout, any example code would be much appreciated Manu thanks Hi, I have a form and am calling the insert into page using ajax. However when I click on submit my welcome page, set as my default page is called. Looking around I think possibly a 401 is being generated by my Header and so it is being set to my default page. So I guess my questions a 1. Is this the most likely reason or when you look at my script does something else spring to mind? 2. How would I test to see if I am right (I tried getHeader but I don't think I understood how to set it out properly) 3. How would I resolve this. My code is: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html> <head> <script type="text/javascript"> function loadXMLDoc(File,ID){ if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function(){ if (xmlhttp.readyState==4 && xmlhttp.status==200){ document.getElementById(ID).innerHTML=xmlhttp.responseText; } } var params='wallpost='+encodeURI(document.getElementById('wallpost').value); xmlhttp.open("POST",File,true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.setRequestHeader("Content-length", params.length); xmlhttp.setRequestHeader("Connection", "close"); xmlhttp.send(params); } </script> </head> <body> <?php include("headermenu.php"); ?> <br /> <br /> <form action="" method="post"> <div class="scroll"> <textarea rows="5" cols="60" class="input" name="message" id="message" value="message" > Leave a wall post... </textarea> </div> <br /> <br /> <input type="button" value="Submit" onclick="loadXMLDoc('insert.php','txtHint')" /><br /> </form> <br /> <div id="txtHintWall"></div> <br /> </body> </html> Greetings too all, here is my personal website. Situation I have a relatively simple few lines of javascript that allow me to slideToggle a div (#main-content-info) into (and back out of) display. The div begins with its display set to none and when the header buttons at the top of the page are clicked, (#main-content-info) slides into display. Problem The function stops working when you navigate to other pages in the site (by using the "Browse Portfolio" drop down). Question How do I allow this function to perform on all pages of the site? Please see code below. Code: $(document).ready(function(){ $(".slide-button-one").click(function(){ $("#main-content-info").slideToggle(600,function(){ $("#main-content-portfolio").toggle(); }); return false; }); }); Thank you for your time and I would appreciate any responses, long or short – including "don't do it like that, do it like this." Rob Hi, I coded the following JavaScript: Code: var el = document.createElement("iframe"); el.setAttribute('id', 'ifrm'); document.body.appendChild(el); el.setAttribute('height', 250); el.setAttribute('width', 300); el.setAttribute('frameborder', 0); el.setAttribute('marginheight', 0); el.setAttribute('marginwidth', 0) el.setAttribute('src', 'http://example.com/?pub=1&format=image&size=300x250&url='+window.location); And am putting it between <script type="text/javascript"> and </script> tags in the <body> section of my site. But, it only works in certain areas of the page. Can you guys think of any reason for this? Let me know... Thanks, ~Christian I have this code: Code: <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#username=xa-4c7b22470e521876"></script> I want this JavaScript code above to be executed when all My page finished loading (maybe by using JavaScript onload) So how can I do that? Hi, I'm looking to create a box that shows to IE6 users or lower, to tell them that my site does not render properly in the IE6 browser and that they should therefore upgrade to a newer version or alternative browser. Basically I would put whatever the code to show the box into these tags: Code: <!--[if lte IE 6]> INSERT HERE <![endif]--> to enable it to only appear to IE6 or below users. Preferably when this box appeared, it would be nice if it could fade the page behind it. Does anyone have a script for this or know of a tutorial I could use? The box would also need buttons at the bottom that said "Ok, upgrade me" (this would load another window with links to alternative browsers) or "No thanks" (or "Close") Thanks in advance. Hi all I would like the img src to be populated after page load I'm not sure this is doing what I would like it to do. I have done this. (tag shortened for post) Code: <img src="" id="testImg2" onload="(this.src='images/USA.jpg')"/> Is this populating the img src after page load or when the img tag is loaded? LT Am I saying the onload event wrong or something? PHP Code: <input type="button" value="Mouse" onload="popup_show('popup', 'popup_drag', 'popup_exit', 'mouse', -10, -10);" /> Other events like onmouseover and onClick work |