473,774 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OnClick & IFrames

1 New Member
Hello there, I have a fairly simple problem but since my knowledge of JavaScript is limited, I'm not quite sure how to go about it.

Basically, I am developing a website for selling my products, and I have a menu bar with all the links to these specific products. Already I have the links going into an iframe, where you see the .html file containing the picture and the product's description. What I'd like to do is actually take that descriptive text and place it outside the iframe, in a layer preferably or perhaps even another iframe, but as such ... what I'm aiming for is when you click on the link, two things happen: the iframe gives you the picture, and another layer/iframe gives you the text. Pretty simple? Will I need to make two separate .html files for each product, one for the image and one for the description?

Thanks for your help.

-Bryan
Aug 29 '07 #1
1 1792
markrawlingson
346 Recognized Expert Contributor
Expand|Select|Wrap|Line Numbers
  1. function SetContent(obj,sText) {
  2. var oObj = document.getElementById(obj);
  3. oObj.innerHTML = sText;
  4. }
  5.  
call it like this..

Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:SetContent('yourtargetlayersid','This is a wonderful description of a superb product which you should most certainly purchase!');">Your link</a>
  2.  
You'll, of course, have to have a div/span layer on the page.

Expand|Select|Wrap|Line Numbers
  1. <div id="yourtargetlayersid"></div>
  2.  
You can use the function numerous times over, and in what ever context you wish - onmouseover, onclick, onblur, whatever...
Aug 29 '07 #2

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

Similar topics

2
1428
by: Carl | last post by:
I want to load a javascript file on a root page with various iframes, then call the javascript functions from the root page to be displayed in the iframes. Any idea how to do this?
4
2818
by: Jon | last post by:
Hi, I have an iframe in a cell: <td id="contents" width="643"> <iframe width="643" height="232" src="home.asp" frameborder="0" scrolling="no"></iframe> </td> <td onClick="document.all.contents.innerHTML='<iframe width=643 height=232
3
3810
by: f1crazed | last post by:
Hello, I am wanting to fire the onClick event of button1 by pressing button2. Does anyone have a clue if this is even posible? If so PLEASE HELP!! Thanks.
4
16425
by: Jerry Sievers | last post by:
JS Programmers, "I'm a server-side coder PHP, Postgres etc... My question; Given the following anchor <a href="http://www.somesite.com/somefile.html">link text</a> Is there a way to code an onClick event to call a script and pass the href URL and link text? That is; We'd like to put an identical piece of JS code into each
7
1153
by: Thomas | last post by:
Hi all! Currently I have a web application that consists of a classic frameset. I would like to rebuild the application and just use tables or layers. The problem is, that some parts of the application need to be refreshed at a given interval. Currently, these parts run in a separate frame and a JavaScript function reloads the page every x seconds. In the new scenario I could use iframes, but I would prefer another solution to avoid page...
4
1773
by: Pete | last post by:
Hello- I am have a real trying time finding information on this subject. I would like to create a web page that utilizes framesets (top & bottom) and a navigation control I created from a datalist that gets data from a sql datasource (sort of like a tabstrip). I'm getting pretty comforatable on the asp.net side of things, but I'm lacking in the javascript department. I understand that I need to add javascript to make the frames work...
0
1263
by: dhruba.bandopadhyay | last post by:
I know that it's possible to mix ASP & ASP.NET 1.1 in the same website/application so long as they are in separate frames (iframes). This also holds for mixing ASP & ASP.NET 2.0 pages. But what I haven't tried is mixing ASP.NET 1.1 & ASP.NET 2.0 pages in the same website/application but each page in different iframes. I don't think it's possible to to have both ASP.NET 1.1 & 2.0 pages in
8
4963
by: Dan Rumney | last post by:
All, I have a web page (copied below) with 3 images on it of fixed dimensions. Each image has a map associated with it In the maps, there are a number of areas with an onClick handler registered (in this sample, just an alert) The HTML is valid.
4
2960
by: ismailc | last post by:
Hi, I need help please. I need to create a textbox with a report url in an iframe below. Onclick of button create IFrame and pass textbox value into parameter of iframe src. I'm not to sure how to do this, i think some javascript is needed as I want the button to check the textbox is not blank value first and then create iframe and pass textbox value as parameter. Does anyone have another method where there are 2 iframes: Having the...
0
9621
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10040
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6717
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4012
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 we have to send another system
3
2852
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.