Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
can I do this function
Old 12-19-2008, 07:50 AM can I do this function
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 310
Name: Jason Eyermann
Location: england bristol
Trades: 0
var quantityBox = document.getElementById("quantityBox");

if (quantityBox.style.display == "block") {
// function here
}

I can't seem able to get this to work. Is the code above correct?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
 
Register now for full access!
Old 12-19-2008, 04:56 PM Re: can I do this function
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
depends,

do you specifically set the display value first somewhere?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 12-19-2008, 04:59 PM Re: can I do this function
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Is the code below the HTML element with an ID of "quantityBox" (preferrably at the end of the page), or inside of an onload event? Or is it just sitting in the head, with nothing triggering it?
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 12-23-2008, 07:45 AM Re: can I do this function
jason_bristol's Avatar
Ultra Talker

Latest Blog Post:
New site - ConnectFrench.com
Posts: 310
Name: Jason Eyermann
Location: england bristol
Trades: 0
Quote:
Originally Posted by chrishirst View Post
depends,

do you specifically set the display value first somewhere?
Yes I have. The display is set to either block or none depending on what page they are viewing

Quote:
Originally Posted by wayfarer07 View Post
Is the code below the HTML element with an ID of "quantityBox" (preferrably at the end of the page), or inside of an onload event? Or is it just sitting in the head, with nothing triggering it?
quantityBox is an Id set in the body and inside the html
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

Last edited by jason_bristol; 12-23-2008 at 07:46 AM..
jason_bristol is offline
Reply With Quote
View Public Profile Visit jason_bristol's homepage!
 
Old 12-23-2008, 09:36 AM Re: can I do this function
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Quote:
Originally Posted by jason_bristol View Post
quantityBox is an Id set in the body and inside the html
That's not what I asked. If your script isn't in a place where it will have access to the HTML, it won't matter.

The reason I bring this up (you haven't given us much of a clue since we can't see the whole page), is that many people who are new to JavaScript don't realize that scripts will have absolutely zero access to the HTML unless:
  1. The script is inside of or triggered by an onload event.
  2. The script appears somewhere below the HTML that it needs access to.
That said, there isn't anything actually wrong with the code you showed us.
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Reply     « Reply to can I do this function
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.21958 seconds with 12 queries