JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 3rd, 2012, 12:05 AM
Frank Lovejoy Frank Lovejoy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Posts: 3 Frank Lovejoy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 31 m 45 sec
Reputation Power: 0
Other - Passing array index value from img src trigger

I have googled everywhere but cannot find a solution.
Hopefully someone can help me here!?

By clicking a trigger image, I want to also pass an index value to my object inside my document.write text array and image array.
Simply adding ?xx=1 to the clicked img src does not work.
There must be some work-around that will succeed.
Passing this index value will save a lot of repetitious coding.
Thanks for any help!

Code:
<!DOCTYPE html>
<html><head><title>PopupOverlay</title>
<script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
<style>
a:active {
    outline:none;
}
:focus {
    -moz-outline-style:none;
}
.simple_overlay {
    display:none;
    z-index:10000;
    background-color:#fff;
    width:260px;
    min-height:300px;
    border:1px solid #666;
    -moz-box-shadow:0 0 90px 5px #000;
    -webkit-box-shadow: 0 0 90px #000;
}
#triggers {
  text-align:left;
  }
#triggers img {
  cursor:pointer;
  margin:0 5px;
  background-color:#333;
  border:1px solid #ccc;
  padding:2px;
  -moz-border-radius:4px;
  -webkit-border-radius:4px;
  }
.details {
  position:absolute;
  top:15px;
  right:15px;
  font-size:15px;
  color:#000;
  width:220px;
  }
.details h3 {
  color:#000;
  font-size:17px;
  }
  </style>
</head>
<body>

<div id="triggers" class="noprint">
  <img src="red.png?xx=1" rel="#mies1"/><BR>
  <img src="green.png?xx=2" rel="#mies1"/><BR>
<img src="blue.png?xx=3" rel="#mies1"/><BR>
</div>

<script language="JavaScript">
var myimages=new Array()
myimages[1]="banana.png"
myimages[2]="apple.png"
myimages[3]="orange.gif"
</script>

<script language="javascript">
var info = new Array();
info[1] = "Audi";
info[2] = "Volvo";
info[3] = "BMW";
</script>

<div class="simple_overlay" id="mies1">  
  <div class="details">
    <h3>Heading</h3>
    <script language="JavaScript">
document.write('<img src="'+myimages[xx]+'">')
</script>

<BR><B>Topic</B><BR>

<script language="javascript">
document.write(info[xx])
</script>
  </div>
</div>

<script>
  $(document).ready(function() {
      $("img[rel]").overlay();
    });
</script>
</body>
</html>

Reply With Quote
  #2  
Old December 3rd, 2012, 02:13 AM
Winters Winters is offline
Super Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jul 2003
Posts: 3,874 Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level)Winters User rank is General 24th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 2 Weeks 1 Day 17 h 23 m 53 sec
Reputation Power: 2569
Stop using buzz words as they are just rendering your question meaningless.

A GET method query string is generally used to send data to the server. It is used in some cases for client-side pass-over but would be an overly laborious method in this instance.

There are a series of images that when clicked should send the appropriate index key to your script, to select the appropriate image url from an array and insert it into the document?

Should the output image change each time, or should multiple images be created?
__________________
[PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

W3Fools - A W3Schools Intervention.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Other - Passing array index value from img src trigger

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap