Jump to content

lamboman

Members
  • Posts

    18
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

lamboman's Achievements

Member

Member (2/5)

0

Reputation

  1. I have these buttons and this script works great thanks to help from people here. Now what I want to do is use the exact code but instead of images, I want the onclick to load an external script called “externalscript” and "externalscript2" in the "span id" area. I am fairly certain I just replace my "<img src='"+img+"'/>" with "<src="externalscript.js"> and my 'x','images/1.gif' with 'x',src="externalscript.js" but something still seems goofy. <script language="JavaScript"> function changeimage(id,img){document.getElementById(id).innerHTML = "<img src='"+img+"'/>";}//end replaceImage </script> </head> <body> <table width="200" border="1"> <tr> <td colspan="5"><button type="button" onclick="changeimage('x','images/1.gif');changeimage('x','images2.gif');">Show Image 1</button> <button type="button" onclick="changeimage('x','images/1.gif');"> Show Image 2</button> </td><td width="6"></td> </tr> <tr> <td width="145"> <p><span id='x'><img src='images1.gif'/></span></p></td> </tr> </table> </body> </html>
  2. Just what I needed, I cant thank you enogh.
  3. Still not quite what I am looking for. Lets do it this way. 2 buttons, both with a different value. <td><button type="button" replaceImage="image1">Show Image 1</button></td> <td><button type="button" replaceImage="image2">Show Image 2</button></td> All that I want to do is diplay the image depending what is selected. <img id="image" src='replaceImage'/> (i belive this is all I need help with, I just need to display the variable)
  4. No thats not quite working. Lets do it this way,. I need this to display the variable "image". Right now it just displays "image1". I need it do display the variable "image" which could be any number of pics depending what is selected. <img id="image" src='image1'/>
  5. Ok, I need two things, first. How would I specifie that these two links would be 2 different variables, the first one would be image1.gif, the second image2.gif <p><a href='#' onClick='replaceImage();' title='Reload image'>option1</a></p> <p><a href='#' onClick='replaceImage();' title='Reload image'>option2</a></p> This is the second problem, How would I call up the image based on the button selected (right now this just calls up image1) <img id="image" src='image1'/> I hope this make some sort of sence.
  6. Ok maybe this will be eisier. One side of the page has a couple buttons. Depending which button is pressed, an image will be displayed on the other side of the page. I know I am close with this script, but it still doesnt work. (Here is my variables and function:) <SCRIPT LANGUAGE="JavaScript"> function chosen(img_name,img_src) { document[img_name].src=img_src; } <!-- if (document.images) { pic1 = new Image(); pic1.src = "..pic1.gif"; pic2 = new Image(); pic2.src = "..pic2.gif"; } //--> </SCRIPT> (Here is my buttons:) <button type="button" chosen="pic1()">Show Image 1</button> <button type="button" chosen="pic2()">Show Image 2</button> (And here is where I want the image displayed acording to the button selected:) <p id="chosen"> Hope that makes some sence.
  7. I am new to javascript but have a fairly good understanding of it but am having a problem whith this. First I want to start off with loading a bunch of variables (they are images I am using as variables). Then I will have some buttons on one side of the sreen. Depending what button is pressed, it will display an image on the other side of the screen. I know i need to create an event for this to happen, but I am having a problem getting it right. (this is for my variables, I know I need the event in here, but not having any luck) <SCRIPT LANGUAGE="JavaScript"> <!-- if (document.images) { var pic1 = new Image(); pic1.src = "..pic1.gif"; var pic2 = new Image(); pic2.src = "..pic2.gif"; } //--> </SCRIPT> (this is my buttons on the one side of the page) <button type="button" onclick="pic1()">Show Image 1</button> <button type="button" onclick="pic2()">Show Image 2</button> (and finnaly this is my action to display the image on the otherside, I just called it function1 for now) <p id="function1">
  8. I have 3 images Shown below. What I want to do is add an onclick that will change another variable (lets call it $secondary). So when any one of these are clicked it will change the variable $secondary to whatever I want it to be. (hope that makes sence) <?php $main[0]="<img src='images/00.gif'>"; echo $main[0]; ?> <?php $main[1]="<img src='images/01.gif'>"; echo $main[1]; ?> <?php $main[2]="<img src='images/02.gif'>"; echo $main[2]; ?>
  9. I am looking for a very simple script. I need to have 4 images one one side of the screen, when either of them is clicked a single image on the other side of the screen will change according to what is clicked. All the images are different including the otherones on the side of the screen. Any help is appriciated Thanks in advance
  10. I need to do everything before the post. When a user click on the radio button, certain images on the same page will change as will some text. I need to set each button as a variable so that when it is clicked it will change the information on the same page at the same time
  11. Just on how exactly do I define the button as a variable?
  12. I am wondering if this is posible. I have a group of radio butons. I would like to make them as variables so that I can use an "if then" statment in another part of the page to show an image depending on which button is selected. <form id="form1" name="form1" method="post" action=""> <p> <label> <input type="radio" name="color" value="red" id="color_0" /> red</label> <br /> <label> <input type="radio" name="color" value="blue" id="color_1" /> blue</label>
  13. Thanks dougjohnson, that made it work.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.