473,766 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing <div> content not working.

3 New Member
I have an image gallery that pops up an enlarged version of a picture when someone clicks on it. That bit works, but it should also load the picture's caption into the floating layer. Instead the caption remains unchanged and gives an "object doesn't support this property or method" dialog.

The code is as follows:

Expand|Select|Wrap|Line Numbers
  1. <script>
  2.   function goBig(objNo, caption)
  3.   {
  4.   document.getElementById('floatdiv').style.visibility = 'visible';
  5.   document.getElementById('floatimg').src = document.getElementById('i'+objNo).src;
  6.   document.getElementById('dd1').style.visibility = 'hidden';
  7.   document.getElementByID('floatTxt').innerHTML = caption;
  8.   }
  9. </script>
  10.  
Expand|Select|Wrap|Line Numbers
  1. <a href="#" onClick="goBig('2','This is the caption');">
  2. <img src="image.jpg" height="100" width="150" border="0" id="i2" />
  3. </a>
  4.  
Expand|Select|Wrap|Line Numbers
  1. <div id="floatdiv" [style code/closing javascript removed to keep things short]><img id="floatimg" src="blank.gif" style="width: 800px">
  2. <br />
  3. <div id="floatTxt">.</div>
  4. Click on the image to close.</div>
  5.  
Thanks in advance.
Oct 28 '06 #1
3 1984
Thevercad
26 New Member
hi,

can you try the following code?

Expand|Select|Wrap|Line Numbers
  1. document.getElementByID('floatTxt').innerText = caption;
I think, this might work.
Oct 30 '06 #2
chris1606
3 New Member
Just tried that, it didn't work at first, but then I spotted the capital "D" in getElementById in my original code. :p.

All working now, cheers for the help.
Oct 30 '06 #3
Thevercad
26 New Member
Sorry about that mistake. I'm glad its working now. :-)
Oct 31 '06 #4

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

Similar topics

13
3404
by: Mikko Ohtamaa | last post by:
From XML specification: The representation of an empty element is either a start-tag immediately followed by an end-tag, or an empty-element tag. (This means that <foo></foo> is equal to <foo/>) From XHTML specification:
55
7304
by: Ton den Hartog | last post by:
Stupid basic question but I find it horribly imposible to find the answer elsewhere... :-( I want to have a piece of text in my HTML page and want to be able to change it in a Javascript function that is called from a button. I think I can use a <div id="t"></div> for this ? Something like
61
24502
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will 'stretch'</td> <td valign="top" width="300">some data that won't 'stetch'</td> </tr> </table>
2
5255
by: rpesq | last post by:
Hi, I Need help changing the content of a DIV. I sincerely researched the issue and have not found a solution except to scrap the idea and stick with the iframe code that I had been using. My purpose here is to avoid iframes. I know how to change the DIV content to other basic html statements, such as basic IMG's or Lists, but I want to put a Javascript into the DIV, and have not found a way to do it.
2
17501
by: alexrib | last post by:
Hi, I have a web application which uses external CSS files extensively. Now, I need to port this application to run inside a portlet. So, it will not generate a complete HTML document, but just a fragment. How can I apply an external CSS file not to the whole HTML document, but just to a div section ? I see 2 alternatives: 1) to use a system prefix in every ID and CLASS attribute. This will
2
6027
by: Rodney Dunning | last post by:
Forgive me if this is a stupid question. I have a course syllabus located at http://www.longwood.edu/staff/dunningrb/teaching/easc101f06/easc101f06_syllabus.html. I use a <divcontainer for the main content of the page. When I print the page, or select Print Preview, I get only a single sheet, even the though the content should run to three sheets of paper. In Print Preview, the content simply runs off the bottom of the window, while...
2
3425
by: vidyasada | last post by:
Hi i m new to javascript . i need a script to srcoll the <div> content vertically within the <div> and it stops few seconds at the end of the content .. and again starts scrolling.. please anyone help.. thanks in advance, -vidya.
10
3201
by: Summercoolness | last post by:
so i am starting to use more of <br /and <div style="clear: both" / which is the XHTML style... now, won't those actually confuse the old browsers? for example, will the old browser treat the "div" as not closing, and so everything after the div will be treated as part of that div?
5
2532
by: obwatter | last post by:
i'm trying to recreate what i *think* should be a simple CSS/JS <div> content reveal / swap. just like this one ("A Tale of Two Pets", near bottom of page): http://www.castorpolluxpet.com/our_story been trying to figure it out on my own for about 2 days now & have run out of ideas. *** NOTE: my JS skills are currently limited to rollovers & pasting snippets written by "the javascript guy" who used to work in our office.
8
10047
prino
by: prino | last post by:
Hi all, I've written code (in REXX) that takes files in legacy languages (PL/I, COBOL, z/OS assembler, etc) and converts them into HTML in a format similar to what's displayed in the z/OS ISPF editor. A fellow member of the PCG has helped me by creating a bit of Javascript to emulate the scrolling and using Google I've now gotten it into a state where it almost passes the W3C Markup Validation Service. However, the one error, Error Line 166,...
0
9568
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
9404
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
10168
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
9959
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,...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
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();...
0
5279
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
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

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.