Copy Source_image Src To Another Image From Onclick
Sep 5, 2007
Im having trouble with my js. I have a series of img tags. each one needs to run a function with the onclick event. In the function I want to copy the src of the image into the src of a main -larger- img tag. I tried something like this:
function doit(){
var node = this;
var dest_div = document.getElementById("bigimagediv");
I tried this but its 'not a function' =/
function doit(){
var node = this;
var nodesrc = node.getAttribute("src");
dest_img.setAttribute("src", nodesrc);
}
but it doesnt work. I _do_ want to the keep the image thumbnail on the page, so maybe a copyNode or something else.
Please visit the following page if you want to see the page I am working with. The flower images at the bottom, when clicked, will display the src of that image when clicked in the textbox. However, I want to apply the same function to the manipulated images too, in order to get their data URL's. Currently, the images at the bottom have the following:
Code: <img src="images/nem.png" onclick="clicked(this)" /> How would I go about adding the onclick to the following javascript generated images?
Code: var dragon = new Image(); dragon.src = "images/flower2.png"; var dragon2 = new Image(); dragon2.src = "images/oldtraff2.png"; var dragon3 = new Image(); dragon3.src = "images/trees2.png"; var dragon4 = new Image(); dragon4.src = "images/f12.png"; var dragon5 = new Image(); dragon5.src = "images/nem2.png"; var dragon6 = new Image(); dragon6.src = "images/nl2.png"; var dragon7 = new Image(); dragon7.src = "images/dino2.png"; var dragon8 = new Image(); dragon8.src = "images/ipad2.png"; var dragon9 = new Image(); dragon9.src = "images/tokyo2.png"; var dragon10 = new Image(); dragon10.src = "images/pup2.png";
I have small issue with the below javascript code. I am trying to create a button which copies the text of one field into another text area. This works fine at the moment but now I want to copy the text into the textarea instead of overwrite the value which was entered previously.
does anyone know how to apply onselectstart and ondragstart to just one image on a page?
All of the posts I have found so far suggest adding these to the body tag. The disadvantage of this is that it prevents users from selecting anything at all on the page.
I need to isolate this to one particualr image. I've tried adding the selectstarts to divs, the img tag etc but it doesn't seem to work.
This may seem an odd question, but is it possible to write a script in JavaScript or even Java to copy an image from one browser window and paste it somehow in another window? Or is it impossible for security reasons?
I paid for some to create a slideshow, and it works fine in the orginial html document but when i copy and paste the code into my html document the scroller to the left of the image stops moving up and downI put the working file at thisthe guy i paid to do work refuses to help even those i advertised the price in my ad and he wanted me to give to pay him more to tell which code to change
I am using ContentFlow from [URL] It is very well documented on their website. I got the whole thing working great on my site. What I don't know is how to change the ActiveItem onclick to just bump it over to the next image as if the next image had been clicked. As of right now it opens the image source in a self window. I don't want that. Can anyone give me a clue or maybe the whole answer on how to get it to click over to the next image? I believe the answer lies in the contentflow_src.js file.
From any page, I want to be able to call a JS function that will do the equivelant of select all, and copy. This data will then be posted to a page that will log it.
This would be easy using copy/paste functionality but I don't want to screw-up users copy/paste buffer. Anyone have an example of how to retrieve all text with similar formatting of copying page to notepad without using copy/paste functionality?
I am trying to make a point and click javascript game. Basically what I want is to have one image displayed on screen at the start (room1.jpg). When you click on a door on that image, I have an onclick event to change the image to a new one that shows the door open (room1_a.jpg). What I want is that when you click the now open door, to display the next room in the game. The only solution I can think of is some sort of nested onclick event using several image maps, but I am fairly new to Javascript and I am not sure if that is possible. What it all comes down to is I want to display each incarnation of each room in the game in the same window without having to reload a new window for each room. I hope that makes sense, if not I can try and clarify. Below is the code I have so far. And as you can see all that does is display the open door when you click on the image. I have not done any of the image mapping yet.
I'm trying to use javascript to load an image on a webpage when another image is clicked on, just like an image gallery and just like this except I don't need any text: [URL] I copied the example above but when I click on the smaller image to load the larger one it works for a fraction of a second (I can see the image load in the right spot), but then the browser goes to the URL of the image instead (showing it on a blank page).
Im looking to basically have an image which is a button with a value, and when i click the image, it gets replaced by another image with a different value. when clicked again it would return to the original image and value..Is this possible? and if so, please help cos im terrible at javascript!
Should I disable the right click option or not? I have a gallery site, I don't want people to be able to copy the images with the default right click over an image. From a professional looking site point of view I suppose I would be messing with the functionality a bit too much, OR is it OK in this instance to disable the click. I know how to write the code to disable the click, but what I was thinking was maybe it would be better to leave the right click but change the menu options? I'm not sure how to change the menu options ere is a link to the site. [URL]
I have a number of images whose src's are changed when a button is pressed. At the moment the href is also changed and the images are opened. However I have a function which opens the images in their own windows. I want to run this for each image using the onClick event of the image. I have all the images and links stored in there own array's. I would like to do the same for the onClick events. I have tried creating an array an storing the onClick events in it.
i.e. images_onClicks[2] = "image_popup('image.jpg',100,100,100,100)"; and then changing the onclick event for the image. i.e. document.getElementsByName("image1")[0].onclick = images_onClicks[0];
However I just can't get it to work. Could anyone please tell me if there is something that I am missing.
I have this javascript code which I'm using for collapsible tables:
<html> <head> <script type="text/javascript"> function getItem(id)
[Code]....
So what I'm trying to do is display the image /path/to/plus when the table is closed, and then display the image /path/to/minus when the table is open.
I am creating a little portal for my design department at work. On the homepage of the portal, there is a section for a random image that people can submit. This image has a preset width and height so it fits into the layout. When you load the index page, it randomly selects one of the images from the database. However, I want people to be able to click on the image and load a different one. I don't want to reload the entire page and get a new randomly selected one because it is possible they could keep getting the same image over and over. If they random get image #5, I want them to see image #6 when they click, then image #7 when they click again, so on and so forth. When they reach the last image, they go back to image #1. Make sense?
Any ideas? I have tried looking at scripts that automatically change the image (with cute little fade ins), but I want the change to happen based on the user's actions.
How can I grab the image name "cat05_",add the proper ID to it, then swap the image? I cannot hardcode the name into an array as the page is dynamic so the image name changes on what page the user is on.
What I want it to do is load the image by the number that was pressed. onLoad would be cat05_1. So if number 2 was pressed cat05_2 would be pressed, cat05_3 would load if 3 was pressed. Code:
I've set up a few images to change onlick using the following code (I have the alternate images saved as jpgs in the img/ directory). There are two problems I'm having the first baffles me, after clicking one image and changing it the other images take 2 clicks before changing. The other problem is more of a curiosity, I plan to have these images work as a sort of check box for a sql database query and I'm not entirely sure my current way of doing it will allow for that.
Code: <body> <head> <script language="JavaScript" type="text/JavaScript"> var q=0;
[URL].. There is currently a hidden div called fullsize in the content which i have hidden by putting display:none in the css on that div. But I need to get that div to display when a user clicks on a thumbnail from the horizontal scrolling gallery.
I have been trying to get it to work for about 3 hours but can't see what it is.
I'm trying to achieve something (which doesn't seem to difficult to me) but I can't get it to work. I want to embed video's through a swf-videoplayer on my website. The idea is that I have (say 750 * 400 px) images wrapped in links. The links point at the videofile. If the user clicks the link, I want to replace the link+image by the swf video with the same dimensions...
just getting started with JQ so i hope you can help me out with it Idea is that the element is a rotation of four images changing on click.basic HTML behind it is
<li><a href="#" class="puzel"><img src="images/puzel1.jpg" /></a></li> and JQ behind is currently like that $(".puzel").click(function(){
I am trying to create an image viewer with javascript and CSS. Unfortunately however, the onclick events in my image tags seem to work every once in a while for a few page loads then for some reason they just stop working completely and seemingly for no reason at all (i.e. I dont change any code). I've been messing around with this for at least a couple of weeks now and cant figure it out, so it is time to hit up the forums.