473,396 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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_OnClick(pintDivNum)

document.all.item("div_" & pintDivNum & "_details").style.display = "block"
document.all.item("img_" & pintDivNum & "_collapse").style.display = "inline"
document.all.item("img_" & pintDivNum & "_expand").style.display = "none"

End Sub
I want to re-do this JavaScript, e.g. function ShowSection_OnClick(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.all 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 1250
"Trev@Work" <no.email@please> wrote in message
news:41***********************@news.easynet.co.uk. ..
I'm converting a site from VBScript to JavaScript, I have the following
code in vbscript:
Sub ShowSection_OnClick(pintDivNum)

document.all.item("div_" & pintDivNum & "_details").style.display = "block" document.all.item("img_" & pintDivNum & "_collapse").style.display = "inline" document.all.item("img_" & pintDivNum & "_expand").style.display = "none"
End Sub


I want to re-do this JavaScript, e.g.
function ShowSection_OnClick(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.all 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.getElementById("div_" + pintDivNum + "_details").style
Jul 23 '05 #2
McKirahan wrote:
"Trev@Work" <no.email@please> wrote in message
news:41***********************@news.easynet.co.uk. ..
I'm converting a site from VBScript to JavaScript, I have the following
code in vbscript:
Sub ShowSection_OnClick(pintDivNum)

document.all.item("div_" & pintDivNum & "_details").style.display =
"block"
document.all.item("img_" & pintDivNum & "_collapse").style.display =
"inline"
document.all.item("img_" & pintDivNum & "_expand").style.display =
"none"
End Sub


I want to re-do this JavaScript, e.g.
function ShowSection_OnClick(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.all 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.getElementById("div_" + pintDivNum + "_details").style


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
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...
13
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,...
7
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....
4
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...
22
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:...
4
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...
16
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...
1
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...
21
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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...
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,...

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.