Jump to content

Recommended Posts

It's not a good practice to name variable like this

 

if its a delete button then you should name it as - btnDelete

if some Variable is there then it should be - varName

 

do u get some error if you use document.photocomment.delete.style.visibility ... something like this ?

It's not a good practice to name variable like this

 

if its a delete button then you should name it as - btnDelete

if some Variable is there then it should be - varName

 

Hmm that's kinda what my Visual Basic tutor taught me at college, but to be honest I don't follow it. I find it a much bigger ball ache than it's worth; meaningful variable names should avoid any confusion. As for 'delete', I don't even think it's a prototype is it? What errors do you get?

 

EDIT: I've found a 'delete operator'; but that uses a different syntax so shouldn't cause any problems...

Ok, I am in TOTAL agreement with those above - do not name elements "delete" or anything else that would cause a conflict. But, just for educational purposes, there is a workaround.

 

document.photocomment['delete'].style.visibility = ...

 

I only pose this because if you have fields named so they will be processed as arrays (i.e. name="foo[]") then you need to use this method to reference the fields.

 

var fieldsArrayObj = document.formName['foo[]'];

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.