473,396 Members | 2,014 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Passing an image name as an argument

Hi,

I would like to be able to open a web page and pass it the name of the picture that I want displayed. For example, the current line that displays the picture reads

<td width="762" bgcolor="#FFFFFF"><img src="165_6593.jpg" alt="" name="" width="760" height="570" border="0" /></td>

Each of the images that I want to display are the same size, so all I'm concerned with is being able to change the name of the image when I call the page. For example, if the page is called www.dandare.com and I want it to display the image dan.jpg then I'd like to call it using:
www.dandare.com?dan.jpg

dan.jpg would then be substituted for "165_6593.jpg"

This is probably easy, but I did my IT degree in 1990 when DOS was king!

Thanks in advance...
May 24 '07 #1
2 1471
iam_clint
1,208 Expert 1GB
put this at the bottom of your html page
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. window.onload = setImage();
  3. function setImage() {
  4. var theimg = document.getElementById("img1");
  5. var winloc = window.location.href;
  6. var qstring = winloc.split("?")[1];
  7. var qimg = qstring.split("=");
  8. if (qimg[0]=="img") { theimg.src = qimg[1]; }
  9. }
  10. </script>
  11.  

then try it out like this

http://www.wherever.com/whatever.htm?img=dan.jpg

or www.wherever.com?img=dan.jpg
May 24 '07 #2
Thanks- that's fantastic and worked first time!
May 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Alex Vinokur | last post by:
Various forms of argument passing ================================= C/C++ Performance Tests ======================= Using C/C++ Program Perfometer...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
17
by: Charles Sullivan | last post by:
The library function 'qsort' is declared thus: void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); If in my code I write: int cmp_fcn(...); int...
4
by: B Squared | last post by:
I'm trying to pass a string from the current html page to one I'm calling. I've read (in the O'Reilly text) this involves using "?", but there's no example. For example, given I have a standard...
4
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. ...
1
by: User1014 | last post by:
Since you can pass a function to a ... erm...... function.... how to you use the result of a function as the argument for another function instead of passing the actual function to it. i.e. ...
1
by: DanDare | last post by:
Hi, I would like to be able to open a web page and pass it the name of the picture that I want displayed. For example, the current line that displays the picture reads <td width="762"...
5
by: enaz | last post by:
Ok, so, this is my first post, if there is any info i am leaving out please tell me this is the function: function mouseOver(c) { alert(c); <!-- just for debugging--> if (c.src ==...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.