473,657 Members | 2,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Addressing divs, images, etc on a document

I'm converting a site from VBScript to JavaScript, I have the following
code in vbscript:
Sub ShowSection_OnC lick(pintDivNum )

document.all.it em("div_" & pintDivNum & "_details").sty le.display = "block"
document.all.it em("img_" & pintDivNum & "_collapse").st yle.display = "inline"
document.all.it em("img_" & pintDivNum & "_expand").styl e.display = "none"

End Sub
I want to re-do this JavaScript, e.g. function ShowSection_OnC lick(pintDivNum )
{

document.all.it em["div_" + pintDivNum + "_details"].style = "block"
document.all.it em["img_" + pintDivNum + "_collapse"].style.display = "inline"
document.all.it em["img_" + pintDivNum + "_expand"].style.display = "none"
}


But am getting errors like "document.a ll has no properties", I have no
problems addressing form elements but elements outside of forms (divs
and the like ) I'm stuck on.
Jul 23 '05 #1
2 1271
"Trev@Work" <no.email@pleas e> wrote in message
news:41******** *************** @news.easynet.c o.uk...
I'm converting a site from VBScript to JavaScript, I have the following
code in vbscript:
Sub ShowSection_OnC lick(pintDivNum )

document.all.it em("div_" & pintDivNum & "_details").sty le.display = "block" document.all.it em("img_" & pintDivNum & "_collapse").st yle.display = "inline" document.all.it em("img_" & pintDivNum & "_expand").styl e.display = "none"
End Sub


I want to re-do this JavaScript, e.g.
function ShowSection_OnC lick(pintDivNum )
{

document.all.it em["div_" + pintDivNum + "_details"].style = "block"
document.all.it em["img_" + pintDivNum + "_collapse"].style.display = "inline" document.all.it em["img_" + pintDivNum + "_expand"].style.display = "none" }


But am getting errors like "document.a ll has no properties", I have no
problems addressing form elements but elements outside of forms (divs
and the like ) I'm stuck on.


Try:

document.getEle mentById("div_" + pintDivNum + "_details").sty le
Jul 23 '05 #2
McKirahan wrote:
"Trev@Work" <no.email@pleas e> wrote in message
news:41******** *************** @news.easynet.c o.uk...
I'm converting a site from VBScript to JavaScript, I have the following
code in vbscript:
Sub ShowSection_OnC lick(pintDivNum )

document.all .item("div_" & pintDivNum & "_details").sty le.display =
"block"
document.all .item("img_" & pintDivNum & "_collapse").st yle.display =
"inline"
document.all .item("img_" & pintDivNum & "_expand").styl e.display =
"none"
End Sub


I want to re-do this JavaScript, e.g.
function ShowSection_OnC lick(pintDivNum )
{

document.all .item["div_" + pintDivNum + "_details"].style = "block"
document.all .item["img_" + pintDivNum + "_collapse"].style.display =
"inline"
document.all .item["img_" + pintDivNum + "_expand"].style.display =
"none"
}


But am getting errors like "document.a ll has no properties", I have no
problems addressing form elements but elements outside of forms (divs
and the like ) I'm stuck on.

Try:

document.getEle mentById("div_" + pintDivNum + "_details").sty le


thanks, that worked for the Div, as for the images, I used
document.images["..."]
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

39
3607
by: WindAndWaves | last post by:
Hi Gurus I have a page, which looks a bit like this: .... <body> <div ID=id1>................</DIV> <div ID=gsd>................</DIV> <div ID=ewd>................</DIV> <div ID=fac>................</DIV>
13
1593
by: Martin Altschwager | last post by:
Hi, I desperately need some help with what I assume to be a minor problem that I just can't solve. I'm writing a page where on mouseover a link, an image needs to be displayed and some text, which is defined inside an array, sould appear inside a table cell (whose id is "tdDesc"). That's basically what's in the HTML-file:
7
3346
by: adam | last post by:
i'm working on a portion of a CMS that allows content-admins to browse a product list, and add individual products into the taxonomy by clicking checkboxes next to categories they might belong in. since the taxonomy is a rather long list, i'm hiding and showing divs for the secondary and tertiary links, so when a user clicks on the checkbox for the parent category, the children appear in a second (and third) div, with checkboxes of their...
4
1710
by: Gregor | last post by:
I am trying to use an image map with a mouseover function to show various DIV tags. I am not an expert, but what I've come up with works in IE but not in FireFox. Any insight would be greatly appreciated. Below is the js and CSS code <SCRIPT TYPE="text/javascript"> <!-- var layerRef="",styleSwitch="",curMenu="";
22
3316
by: Luke | last post by:
Elements with name attribute: form, input, textarea, a, frame, iframe, button, select, map, meta, applet, object, param, img (if you know more reply...) Methods of addresing html elements: <form name="myform"> <input name="myinput" /> </form> 1. var input = document.forms.myform.myinput;//from nn3+ 2. var input = document.forms.myinput;//from nn3+
4
4219
by: bridgemanusa | last post by:
Hi All: I have a very long page of html that I want to take portions and hide them in divs, then show when a link is clicked. I have the hide show part working when the link is clicked, however I would really like to use linked images instead to do the following: - When open.gif is clicked, the contents of the div show and open.gif is swapped with close.gif - subsequently, when close.gif is clicked, the div contents get hidden
16
2011
by: kdeguero | last post by:
I am using the following script for expandable divs but ...the focus is on the top of the page ie..the div id #quiz, and I am trying to use if for a lengthy FAQ page. when you scroll to the bottom of the page and open a question, the focus pops back to the top of the page. I thought of defining several sections, but when I do only one is collapsed, the others are open on page load <script language="JavaScript" type="text/JavaScript"> ...
1
3479
by: judacris | last post by:
I've seen the threads here about molding 2 divs in a centered fashion. but I can't seem to solve this thing. my blogger blog is functioning well on my site for now, but the blog feed (left) and the sidebar (right) doesn't center here's the css i'm modifying to center it. i apologise for the mess. <html> <head> <title>cris-kun's 'Blog - www.puff-x.com</title> <$BlogMetaData$>
21
2382
by: daydream | last post by:
yeah i need some help(such a common line) ,i have a menu and each link has its own div respectively and yeah obviously when u click the link the div shows, the problem is i would like each div to show no matter how many times you click the link for it and if you click on another one and when u go back to the original , the div would still show. at the moment i have partially done that, i click on item a ,that shows then when i click item b that...
0
8392
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
8305
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
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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
8603
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...
1
6163
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
4151
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
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1944
muto222
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.