JavaScript - Last Post Script?
Hi,
I'm fairly new to coding, so this is all new to me. Basically, I want to implement the "Last post at......" (whuch is found in a container above a new thread/category) feature on my forums. Unfortunately, I don't really know how to. Please could you help me out by pasting the code here. Also, I know very little about Javascript and I'm very much in the learning process. So please just paste the full code rather than giving me cryptic clues :P because I'm really at my wits end now. Thanks James Similar TutorialsHi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani Hello all. I'm working on a project for school and for the life of me I cannot get this to display properly. I'm trying to write a page where a user inputs their billing/shipping info and can click on a box to have it copied over to the opposite form. I've gotten code from several different places, including my text book, but when I call the external .js file, nothing happens. Code: <script type="text/javascript" src="display.js"> </script> I have a separate .js file that I am also using, with similar code that functions perfectly, except when I just add this code to the file, then none of it loads. The only reason that I have this in a .js file is that my XHTML needs to validate in strict. Code: function FillBilling(f) { if(f.billingtoo.checked == true) { f.billingCame.value = f.shippingName.value; f.billingAddress.value = f.shippingAddress.value; f.billingCity.value = f.shippingCity.value; f.billingState.value = f.shippingState.value; f.billingZip = f.shippingZip.value; /* If more fields are used, just expand the parameters above to include the additional fields. */ } } document.write("<form action='FormProcessor.html' name='display' method='get' enctype='application/x-www-form-urlencoded' onsubmit='return confirmSubmit()'>>"); document.write("Shipping Information"); document.write("Name:"); document.write("<input type='text' name='shippingName' size='50'>"); document.write("<br>"); document.write("Address:"); document.write("<input type='text' name='shippingAddress' size='50'>"); document.write("<br>"); document.write("City:"); document.write("<input type='text' name='shippingCity' size='25'>"); document.write("<br>"); document.write("State:"); document.write("<input type='text' name='shippingState' size='2' maxlength='2'>"); document.write("Zip Code:"); document.write("<input type='text' name='shippingZip' size='10'>"); document.write("<input type='checkbox' name='billingtoo'"); onclick='FillBilling(this.form)'> document.write("<br>"); document.write("<br>"); document.write("<em>Copy to billing fields.</em>"); document.write("<br>"); document.write("Billing Information"); document.write("<br>"); document.write("Name:"); document.write("<input type='text' name='billingName' size='50'>"); document.write("<br>"); document.write("Address:"); document.write("<input type='text' name='billingAddress' size='50'>"); document.write("<br>"); document.write("City:"); document.write("<input type='text' name='billingCity' size='25'>"); document.write("<br>"); document.write("State:"); document.write("<input type='text' name='billingState' size='2' maxlength='2'>"): document.write("Zip Code:"); document.write("<input type='text' name='billingZip' size='10'>"); document.write("<input type='submit'>"); document.write("<input type='reset'>"); document.write("</form>"); please help me. On this website: http://evancoleman.net/index.php I really like on the top how the menu has like 5 or 6 icons, and when you hover over them it shows a bubble with the name in them. Does anybody know where I can find this script? Thanks. I have created a quick little pricing engine to price some of the products that we sell. I was able to use a nice template online and it worked for most of what we offer. However, I needed to add a few filters and while doing so, needed to tweak the JS even further than I was originally comfortable with doing. Long story short, here is the main pricing page - www.pricemyleads.com - and this is the page in question as of now - www.pricemyleads.com/taxaged.html The js file for this page is - http://www.pricemyleads.com/js/taxag...alculations.js Any help is greatly appreciated. You'll see the issue when you start clicking on the check boxes. Thanks, brmacdon I need to put more data in the function but i cant do it. $.post('file.php', {data1 : the_data1, data2 : the_data2...and so on...}, func...); the jquery crashes when i do that Hi: How can I extend this so that it posts the data from these 2 fields to an iframe, and what code do I need in the iframe to capture the data and present it in 2 fields? On the sending page, I have <script type="text/javascript"> function passValue() { var ddl = document.getElementById("ddlName"); var index = ddl.selectedIndex; document.getElementById("txtValue").value = ddl.value; document.getElementById("txtName").value = ddl.options[index].text; } </script> <iframe ID="first_iframe" src="http://xxx.net/iPage.html" width="600" height="400"> </iframe> sample code appreciated. Thanks For the record, im a noob at javascript & if there was a lvl below noob id use it to Anyways, my code blow is supposed to automate on a website i use a quantity & submit with just one click using javascript. The help i got wasn't successful as it dosnt act as a URL or interact with the webpage & i need it to be used as a URL. My Goal is to make a simple php page which i already have & a list of links. Now the links will be made up of javascript as soon as i get a working example i can edit. When i click the links, on the webpage it automatically sets quantity & hits the Sell submit button for me, however it dosnt work & im desperate to get it fixed. On the webpage is a slider that sets the quantity, i can manually set quantity as we have to use a slider we click & drag left or right then we click Sell & it sells the type of drugs which is part of the game we wanted. I grabbed the POST info using Live Headers firefox plugin. I hope someone can fix this for me. Live Headers info: Code: POST /fiends.php drugtype=lsd&sqty=5201 Javascript Code: Code: 1."href="javascript: 2.var doc = document; 3.var aForm = doc.createElement("form"); 4.doc.getElementsByTagName("body")[0].appendChild(aForm); 5.aForm.setAttribute("action", "http://www.greedinc.com/fiends.php?drugtype=lsd&sqty=5201"); 6.aForm.setAttribute("method", "POST"); 7. 8.var aInput = doc.createElement("input"); 9.aForm.appendChild(aInput); 10.aInput.setAttribute("type", "hidden"); 11.aInput.setAttribute("name", "drugtype"); 12.aInput.value = "lsd"; 13. 14.aInput2 = doc.createElement("input"); 15.aForm.appendChild(aInput2); 16.aInput2.setAttribute("type", "hidden"); 17.aInput2.setAttribute("name", "sqty"); 18.aInput2.value = '5201'; 19.aForm.submit();"> As a reminder, The javascript i need will act as a URL on my own hosted php page. I will then open the PHP page as a sidebar in my browser which will be firefox. Then when im on the website in question on the specific page, in staid of click & dragging the slider thats part of the POST/Submit that changes the Quantity of what i want sell & then click Sell. I want the javascript acting as a URL to do that for me from the sidebar page. Really hope someone can fix this for me because I've been at it for nearly 3 weeks now & its starting to wear me down to a point where I'm eating Jelly Babies I have a real estate JS slideshow that I would like to modify but have no experience with Javascript. Here is the test link to the slideshow in action: http://coastalrealestateconsultants.com/slideshow.html I want to re-position the three line link caption below the slideshow (price and address) so that it is in a semi-transparent box up in the image slideshow, say centered near the bottom of the image. Can anyone help me? Thank you in advance. I am hoping someone will be interested in helping widen the development of Namesets, a client side application that helps build associative indexes as alternatives to spreadsheet analyses. I tried to attach a set of screenshots in an animated gif illustrating a 'nset' for the design of a building but it gets turned into a jpg and so doesn't work here - but it works here . This shows it as the basis for manipulating components and scenes in Google's Sketchup, but as far as I can see subjects and output are practically unlimited. The purpose of the collaboration would be to construct some sample input lists and output devices, as well as generally reviewing the application (btw - the code passes JSLint except in a very few - excusable! - places.) As the caption states the intention is to offer it in "post a javascript". Thanks I know it's expected behavior for disabled form elements not to post, because they cannot be successful. Fine. But even after I set disabled to false through a javascript function, the form elements will not get posted. Why is that? Does anyone know a workaround? Pseudo code he Code: <input type=text name=blah disabled=disabled /> function blah { all_blah = document.getElementsByName("blah"); for (i=0; i<all_blah.length; i++) all_blah[i].disabled = false; } The intended form elements change their looks in browser, meaning they're enabled, I got javascript to acknowlegde they're enabled, but they still won't post. Thanks for any insights. When I send via GET using XMLHttpRequest to a PHP script then the data is received, but if I do the same with POST then nothing makes it through. Here's my simple JavaScript function (tested in Firefox only) which works with GET but apparently won't send POST data: Code: function requestXML(url, post) { xml_request = false; if (window.XMLHttpRequest) { try { xml_request = new XMLHttpRequest(); } catch(e) { xml_request = false; } } if (xml_request) { xml_request.onreadystatechange = processChange; // Check for POST values. if (post) { xml_request.open("POST", url, true); xml_request.send(post); } else { xml_request.open("GET", url, true); xml_request.send(""); } } } It is called like-so with POST: Code: onClick="requestXML('http://localhost/update.php', this.name + '=' + this.value)" It is called like-so with GET: Code: onClick="requestXML('http://localhost/update.php?' + this.name + '=' + this.value)" The PHP script that responds simply executes print_r($_REQUEST); and the JavaScript function processChange simply displays the output (or an error) in an alert box. If I send via GET, then the alert box displays the values sent. With POST, the alert box is empty. Any ideas what might be gumming up the works? I can't seem to figure out how to post a variable to a javascript pop-up window. I'm trying to get a the users input to post directly to the URL. For example: Code: <!--Pop-up--> <script type="text/javascript"> <!-- function expo() { window.open( "export.php?&export=<?PHP $myvar = $_POST['exportthis']; echo $myvar; ?>", "myWindow", "status = 1, height = 300, width = 300, resizable = 0" ) } //--> </script> <form action="" method="post"><input type=text value="pass-this-variable" name="exportthis"> <input type=button value="Export" name="Exp" onClick="expo()"> </form> Any suggestions? Hello Guys, Any one help me coding of java script coding for watch implementation in our website..... Thanks in Advance This is my first post... and a quick question that is mostly likely easy for most of you!! I am pulling in some data from an MySQL database and generating a graph using RGraph and some HTML. The date pulled in is shown as 2011-01-01 for example. I would like to simply format the date and turn into Jan, 01, 11 or similar. Any recommendations on using Date Object to format that in to the date text? Actually I was trying to use this imagesearch code for one of my blog posts about cars, I want to embed the below codes one for BMW and one for Toyota in the blog post, individually if I place one of these codes they work fine but if I want to place them both together in 2 different blocks separately it doesn't work. Is there a way to achieve this, basically giving 2 different handlers. This will help me a lot - TIA. <script type="text/javascript" src="http://www.google.com/jsapi? key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr 6OwBovxn7TDAH5Q"></ script><div id="TOYOTA">Loading...</div><script type="text/ javascript">google.load('search', '1');var imageSearch;function OnLoadSneha() { imageSearch = new google.search.ImageSearch(); imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET); imageSearch.setRestriction (google.search.ImageSearch.RESTRICT_IMAGESIZE, google.search.ImageSearch.IMAGESIZE_MEDIUM); imageSearch.setSearchCompleteCallback(this, function(){ if (imageSearch.results && imageSearch.results.length > 0) {var contentDiv = document.getElementById('TOYOTA'); contentDiv.innerHTML = ''; var results = imageSearch.results; for (var i = 0; i < results.length; i++) { var result = results[i]; var imgContainer = document.createElement('div'); var title = document.createElement ('div'); var newImg = document.createElement('img'); newImg.src = result.tbUrl; var titleLink=document.createElement('a'); title.className=titleLink.className='gs-title'; titleLink.setAttribute ('href',result.url); titleLink.appendChild(document.createTextNode (result.titleNoFormatting)); title.appendChild(titleLink); imgContainer.appendChild(title); imgContainer.appendChild(newImg); contentDiv.appendChild(imgContainer); } function (imageSearch) { var cursor = imageSearch.cursor; var curPage = cursor.currentPageIndex; var pagesDiv = document.createElement('div'); for (var i = 0; i < cursor.pages.length; i++) { var page = cursor.pages[i]; if (curPage == i) { var label = document.createTextNode(' ' + page.label + ' '); pagesDiv.appendChild (label);} else {var link = document.createElement('a');link.href = 'javascript:imageSearch.gotoPage('+i+');';link.innerHTML = page.label; link.style.marginRight = '2px';pagesDiv.appendChild (link);}} var contentDiv = document.getElementById('TOYOTA'); contentDiv.appendChild(pagesDiv);} }}, null); imageSearch.execute ("TOYOTA");} google.setOnLoadCallback(OnLoadSneha);</script> <script type="text/javascript" src="http://www.google.com/jsapi? key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr 6OwBovxn7TDAH5Q"></ script><div id="TOYOTA">Loading...</div><script type="text/ javascript">google.load('search', '1');var imageSearch;function OnLoadSneha() { imageSearch = new google.search.ImageSearch(); imageSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET); imageSearch.setRestriction (google.search.ImageSearch.RESTRICT_IMAGESIZE, google.search.ImageSearch.IMAGESIZE_MEDIUM); imageSearch.setSearchCompleteCallback(this, function(){ if (imageSearch.results && imageSearch.results.length > 0) {var contentDiv = document.getElementById('TOYOTA'); contentDiv.innerHTML = ''; var results = imageSearch.results; for (var i = 0; i < results.length; i++) { var result = results[i]; var imgContainer = document.createElement('div'); var title = document.createElement ('div'); var newImg = document.createElement('img'); newImg.src = result.tbUrl; var titleLink=document.createElement('a'); title.className=titleLink.className='gs-title'; titleLink.setAttribute ('href',result.url); titleLink.appendChild(document.createTextNode (result.titleNoFormatting)); title.appendChild(titleLink); imgContainer.appendChild(title); imgContainer.appendChild(newImg); contentDiv.appendChild(imgContainer); } function (imageSearch) { var cursor = imageSearch.cursor; var curPage = cursor.currentPageIndex; var pagesDiv = document.createElement('div'); for (var i = 0; i < cursor.pages.length; i++) { var page = cursor.pages[i]; if (curPage == i) { var label = document.createTextNode(' ' + page.label + ' '); pagesDiv.appendChild (label);} else {var link = document.createElement('a');link.href = 'javascript:imageSearch.gotoPage('+i+');';link.innerHTML = page.label; link.style.marginRight = '2px';pagesDiv.appendChild (link);}} var contentDiv = document.getElementById('TOYOTA'); contentDiv.appendChild(pagesDiv);} }}, null); imageSearch.execute ("TOYOTA");} google.setOnLoadCallback(OnLoadSneha);</script> I posted my ActiveX question in HTML but have received no replies so I was wondering if this was the thread to post it in.
I've been trying to find a way of sending a large PHP array to a popup screen. I got something working using GET variables in the URL but ran into the problem of the 2083 max URL length in IE. I therefore decided to try POST variables and came up the the method below. This seems to work fine with Forefox and Chrome; that is I get a popup window and the relevant POST variable. However it doesn't seem to work at all in IE8. I don't get a Popup window and there is no POST variable. Main Screen: popit.php <?php $pass = urlencode(serialize(array("key1"=>"value1","key2"=>"value2",0=>"value3","key4"=>999))); ?> <html> <head> <script type="text/javascript"> <!-- function popup(mylink, windowname, pass) { mypopup = window.open(mylink, windowname, 'width=390,height=390,scrollbars=yes'); mypopup.focus(); mypopup.document.write("<form name='myform' action='" + mylink + "' method='post'>"); mypopup.document.write("<input type='hidden' name='data' value='" + pass + "'>"); mypopup.document.write("</form>"); mypopup.document.close(); mypopup.document.forms.myform.submit(); return false; } //--> </script> </head> <body> <form> <table> <tr> <td> <a href="popup.php" onClick="return popup(this, 'test popup', '<?php echo $pass; ?>')">Click Here</a> </td> </tr> </table> </form> </body> </html> Popup Screen: popup.php <?php echo "\$_POST:<br>"; print_r($_POST); echo "<br><br>"; foreach($_POST as $key => $val) $$key = $val; echo "\$arr:<br>"; $arr = unserialize(urldecode($data)); print_r($arr); ?> |