Jump to content

what does + .$blah + do?


mattjtayl

Recommended Posts

I was sifting through some php code and was wondering what  does

 

"statements" + .$blah +

 

do?

 

for example

 

distcol_id.innerHTML=
"<select name='paytype_distribution_id_" + paytype_id + "_new_" + new_count + "' 
onchange=\"geturl_editemployees_distribution_reset
('" + paytype_id + "','new_" + new_count + "')\"

 

what about "_new_"  is that a php command or just a variable?

 

how about .

postOBJ.addpost(theElement.name,'n');

what does  .addpost do or postOBJ

 

also im trying to piece together what this is supose to do:

onchange="geturl_editemployees_deduction_reset('<?=$ded_row['id']?>')"
onblur=
"if(this.value=='none')
{geturl_edit_employees_deduction_checkdelete(this.parentNode.parentNode.rowIndex-1);}">

 

what does this.parenNode do? this . ?

 

what does  .rowindex -1 do?

 

 

 

Link to comment
Share on other sites

Hi,

 

Sorry, but what you've presented is predominantly javascript and not PHP.

 

But to answer your questions:

 

The + operator in javascript is used either for mathematical operations (ie. 5 + 4) or for concatenating/connecting strings ("hello" + " world" will equal "hello world")

 

However, in your example ("statements" + .$blah + ) you present a strange hybrid of PHP and Javascript... So moving on:

 

as for "_new_" -- that is neither a php command nor a variable, it is a literal string value.

 

I have a feeling you don't understand OOP, nor do you know about the DOM--without which explaining postOBJ, addpost or parentNode, etc. would be too difficult.

Link to comment
Share on other sites

nodes and parents are part of JavaScripts DOM structure, research that a bit and you'll see how it pieces together.

 

the "something"+.$blah.+"something" is a weird mix, first of all, javascript adds a variable to strings using "+" signs, php with periods (concatenating) so having a mix is bugging me out here, since the fact is that $blah is a string and you don't add a string to a string unless you have quotation marks around it (javascript speak).

Link to comment
Share on other sites

actually I did take a Java class and majored in Information Systems, but that was 4 years ago so my knowledge is a little foggy. So somethings I am relearning.

 

If somone could tell me what postOBJ.addpost  and .this does I would appreciate it

 

I know (this) is like a reference in java?

 

I did learn about the DOM in my java class I believe. But I forgot it and I only got a basic understanding from it.

 

and I know nodes are a part of tree. Each element in html is part of the node. So I think parenNode calls what is attached to that node?

Link to comment
Share on other sites

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.