I am a relatively inexperienced programmer and what I want to do here is to have an onClick for a div that reveals a random hint (one at a time) from a selection of 3 (they are all currently on top of eachother and hidden using body onLoad.)
I'm developing a simple CMS and working on a backend now. I want each, lets say, article to have a slideshow editable through a backend site. I created a list of images loaded using PHP from a MySQL database - they are <img> objects in a single <div>. To each <img> belongs a small <div> containing 3 <a> objects formated as buttons: move up, move down, delete (the order of images does matter). This is how it looks like:
I have an ajax script that I would like to use to retrieve a password hint from a database.Both the ajax script and the php retrieval script are stored on the same domain (we'll call it domain1.com), but the ajax script runs on another domain (domain2.com).All the scripts are working fine, individually, but when I try to integrate them, I'm getting a ready state of 4, but an HTTP status of 0. I've traced the code flow and the retrieval script is being called by the ajax script OK and it's echoing all the right stuff, but it's just not getting back to calling ajax routine.
I've read that an ajax routine can only call a script that resides on the same domain that it runs on. Is this correct and, if so, does anyone know of a work around, because I really need to be able to store the ajax script on domain1 and run it on domain2?If not, then can anyone suggest why I'm getting an HTTP status of 0, when all the individual components are working fine?
I got this code from w3schools and I want to alter it for my needs. However I can not get the basic example to work. I have repeatedly cross checked it and can't see any error. I wonder if anyone can spot what I am doing wrong. code...
I have an ajax script that I would like to use to retrieve a password hint from a database.Both the ajax script and the php retrieval script are stored on the same domain (we'll call it domain1.com), but the ajax script runs on another domain (domain2.com).All the scripts are working fine, individually, but when I try to integrate them, I'm getting a ready state of 4, but an HTTP status of 0. I've traced the code flow and the retrieval script is being called by the ajax script OK and it's echoing all the right stuff, but it's just not getting back to calling ajax routine.
I've read that an ajax routine can only call a script that resides on the same domain that it runs on. Is this correct and, if so, does anyone know of a work around, because I really need to be able to store the ajax script on domain1 and run it on domain2?why I'm getting an HTTP status of 0, when all the individual components are working fine?
I'm new to DOM and javascripting and have constructed a hide/show menu. I can't find a way to keep IE6 from revealing all the sub-lists onload. The code (inspired by PPK and Jeremy Keith's recent books) follows:
window.onload = function () { var topnav = document.getElementById ("navmain"); var parent = document.getElementsByTagName("ul"); for (var i=0;i<parent.length;i++) { if (parent[i].className != "section") continue; parent[i].style.display = "none"; var header = parent[i].previousSibling; if (header.nodeType != 1) header = header.previousSibling; header.relatedTag = parent[i]; header.onclick = openClose; } } function openClose () { var currentValue = this.relatedTag.style.display; var newValue = (currentValue == "none") ? "block" : "none"; this.relatedTag.style.display = newValue; } Markup: <div id="navmain" class="clearfix"> <ul><li><h4>Markets</h4> <ul class="section"> <li><a href="/corporate/">Corporate</a></li> <li><a href="/govt/">Govt/Agency</a></li> <li><a href="/municipal/">Municipal</a></li> <li><a href="/mbsabs/">MBS/ABS/CDO</a></li> <li><a href="/funding/">Funding</a></li> </ul> </li></ul> </div>
Hoping for some simple solution, but all advice is welcome.
I am having trouble with the following code. Right now the user clicks the button and it shows all of the blogs from the blog array. However I want it to just reveal 2 then two more and two more and so on as the user clicks button. I have tried multiple things but can't seem to get it right. Most of the things i try either reveal the entire blog on start or when the user clicks hides all of them.
I need to implement a pretty basic javascript functionality in my site, but have never used it and wonder if there is a script available or if someone can give me the basics. I have a nav bar at the top of the page with four links, and then divs for each of the links. The link you click on displays the associated div and hides the rest of them. Pretty simple, right?
I'ld like to insert a feature seen in www.k10k.net and www.rangermag.com whereby once a link is clicked it instantly reveals a hidden layer - seems a great way of quick navigation of info.
I was just wondering if there is a JavaScript tutorial online that shows you how to do similar hover effect to what Twitter does with the trending topics. Such as Inception. When you hover over it and a black bubble appears. Also I'm not sure what it is called.
I'm using a bog standard script which reveals content when something is clicked. This script works fine everywhere else (or it did before I tweeked it a bit to get it to work on this one page; an easy thing to do), however, on this one page, it shows the content, but messes up the layout.
I am trying to create a basic menu where if you put your mouse over a button you get a bit of descriptive text or an image appearing somewhere else on the page. I have tried to do this with hiding/revealing hidden divs - works fine with IE but no others.
<html> <head> <script language="javascript"> var descriptions = new Array(); descriptions[0] = "<p>See whats been added to the web site recently</p>"; descriptions[1] = "<p>Find out more about me</p>"; descriptions[2] = "<p>Check out me links</p>"; function showDescription(descriptionIndex){ .....
I have hidden div, that i want to show by sliding it in from topborder.The problem is that i don't know how to make it "slide in" instead of"wipe in".I want it all to move with it's content instead of showing more andmore of it.
I'm trying to use Javascript to have an array of images that load randomly AND work in a slideshow manner so change every 3 seconds (in a logical order). The code I have below presents a random image but how do I get them to continue from the random image and change to the next every 3 seconds?
I've looked for a solution to this issue, but it seems like a little different scenario than other situations. I made a system for generating friend requests on Facebook. I have a grid that is 6 x 3, for a total of 18 cells. Each cell has a picture in it, and the picture is linked to the Facebook friend request page. My problem is that since each cell is populated at random from the array, I'm getting lots of repeats. For example, some picutures are in 5 cells, and some are in none. I'm trying to figure out how to make it so that once a picture is used once in the grid, it does not get used again in the same grid.I still want every cell filled at random on each page load, I just want to prevent the repeating.
Here's my current code: <script type="text/javascript"> var vip_list=new Array( new Array('http://profile.ak.fbcdn.net/v225/1616/88/s1220771654_2158.jpg','http://www.facebook.com/addfriend.php?id=1220771654'), new Array('http://profile.ak.fbcdn.net/v223/1233/29/s904885342_9055.jpg','http://www.facebook.com/addfriend.php?id=904885342'),
For my website I would like to create a famous last words generator (randomized), and random page generator (within my site). What is the code for random quotes and random links?
I am new to javascript but have been using java for quite a while. I am looking to make a random quote (out of ten possible quotes) appear in my h2 tag in a page i am working on. In java, i would make a random number generator, in javascript it looks like this:
Code: var randomnumber=Math.floor(Math.random()*11) Then make an if statement: Code: if randomnumber=1 { var quote="Live long and prosper" }
document.write(var quote); Could someone more experienced than me tell me if my code looks good and how would a go about getting "var quote" in my h2 tag?
I'm looking for a javascript/css code that can do the following, for a click button:
- When mouse is not over the click-button, a text should be displayed at the right of the button, in a bordered textbox - 85% transparency (hardly visible)
(- when mouse hovers over the button, the button image changes to a different one <- I know how to do this)
- When the button is clicked the text shows up normaly (0% transparency)
- When clicking again the button OR anywhere else on the page, the text goes back to 85% transparency.
I'm new at Javascript, and have written a script for a series of random roll-over button images, but one thing I would like to add is a function that checks to make sure that there are no duplicates in the randomly generated variables that choose the pictures.
Can anyone give me a hand with this? One other thing I can't seem to figure out is how to manage the "onLoad" aspect of caching my roll-over images (DW has locked the <body onload> function into a template, so I can't mess with it...). so my rollover graphics are grabbed from the server in "real time" during mouse-over, which is a bit "goofy" and "slow" in terms of instant rollover effect. I'm sure that there is a much more efficient way of doing this, but I've been able to learn a lot by tweaking DW's way of doing things, so it's not a total loss.
In an external JS file, I set up a series of 10 random variables using the Math.random and Math.round functions like so:
var btn0 = Math.random()*100; btn0 = Math.round(btn0); var btn1 = Math.random()*100; btn1 = Math.round(btn1); .... etc for 10 buttons
Then in my page, I piggy-back onto Dreamweaver's built-in roll-over handlers, like so (to write the instances of each rollover image);
For this particular page, I'm pretty much stuck with DW's coding because it's locked into a template that governs my site navigation. Thanks for any pointers or help ...
I've found examples of bookmarklets that select a URL from a page at random, but I'd like one that generates part of the URL at random.
If you have a bunch of images that are named: mydomain.com/images/abcd.jpg where abcd is can be any combination of 4 lowercase letters - is there a way of having the bookmarklet generate the letters randomly when clicked?
I'm able to do it using AppleScript & Safari but would like it to work from within Safari - which is missing the "Scripts" menu that most Apple apps have :(
It looks as if bookmarklets are the only option, but I've only ever used javascript to select randomly from existing arrays of images and don't fancy typing in the names of a couple of thousand images...