473,473 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Pass variables from a dropdown list?

5 New Member
I'm trying to find a way to create a simple 'targeted ads' function on my page. When a user makes a selection from a dropdown list, I would like to use an onClick function to load an html file with embedded ad(or just image file) to a separate iframe when they submit. I know this in itself is easy enough just targeting the iframe, but I also have a search engine process when the form is sent. If I enter any 'option values' these get processed with the search form and I get errors.
Would anyone have any idea how to accomplish this?

Thanks
Apr 8 '07 #1
2 1816
mark39
5 New Member
Hi guys,

I'm trying to create a targeted ad script that loads a specific ad into an iframe when 'onChange' occurs in a select box (or 'onClick' of submit button-haven't decided yet). My problem is: I can get the ad to load into the frame no-problem, but my conditional statement is skipped alltogether. I have tested with alerts and the function is returning checkbox states (true/false) etc & values are being returned from the select box. Doesn't matter what I do ANY selection causes the ad to load into the iframe.

Please help, I only have a few hairs left.......

Here's the script - I have no idea if I've written it correctly, I've only been at this a couple of weeks.

Expand|Select|Wrap|Line Numbers
  1. <script>
  2.  
  3.  
  4.  
  5. function changeAd(){ //this function being called from select box with: 'onChange=changeAd()'
  6.  
  7. var currentSel = document.getElementById("selection").value; //dropdown select box with ID of selection
  8. var duff = document.getElementById("duff").checked; //checkbox with ID of 'duff'
  9. var well = document.getElementById("well").checked; //checkbox with ID of 'well'
  10.  
  11.  
  12.  
  13.     if (duff == true && currentSel == "Alarm Systems and Monitoring"); //this statement is being ignored.
  14.     { 
  15.     document.getElementById("adbox").src = "ads/ad5.jpg"; //this IS occurring regardless of selection
  16.     }       //the entire script is acting like: onChange=document.getElementById("adbox").src = "ads/ad5.jpg";
  17.     }
  18. </script>
Apr 26 '07 #2
mark39
5 New Member
Nevr mind , I figured it out.....stupid semicolon at the end of the 'if' statement.

it's always the little thigs........
Apr 26 '07 #3

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

Similar topics

1
by: Joseph Barron | last post by:
Here is a SIMPLE problem that I'm trying to solve. It works in Netscape 6.2, but IE6 gives ""No such interface supported." Below are page1.htm and page2.htm . In page1.htm, there are two...
5
by: Nate | last post by:
Is there any way within asp.net to pass user defined parameters/variables to an executable? Much thanks. nate
6
by: Mark | last post by:
I have two dropdown lists. Both have autopostback set to true. In both dropdowns, when you select an item from the list, it redirects to the Value property of the dropdown. Nothing fancy. ...
5
by: jung_h_park | last post by:
From: jung_h_park@yahoo.com Newsgroups: microsoft.public.dotnet.framework.aspnet Subject: Dropdown List not retaining its SelectedValue Date: Mon, 26 Jun 2006 21:02:57 -0700 Hello, My...
3
by: er1 | last post by:
Hi all, I have created a double dropdown list. Based on the first list selection, second list populates (this works fine). I have a submit button, which when clicked should run a select query...
1
by: prathna | last post by:
Hi all, I would like to know how to pass a form bean value to javascript function to perform some validation.. I have a dropdown list and a textfield. I have created the dropdown list using...
3
by: fish919 | last post by:
Hello All, I am creating a date base in access. I want to create a dropdown list box that is connected to another dropdown list box. You start with a dropdown list that has 5 choices and each of...
5
by: abhi3211 | last post by:
i am using java inside java script page. in that page i want to use two dropdown list. in first dropdown list i am getting data from ms-access database. in second dropdown list i want to get data...
10
by: Dan | last post by:
Hi, I create 5 dropdownlist in code-behind. I want to insert their selectedvalues in a table by making a string separated with ":" I can get their selecedvalues but i'm stuck when i want to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.