Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Help needed with Javascript (https://www.warriorforum.com/programming/146002-help-needed-javascript.html)

coolboycsaba 18th November 2009 06:25 AM

Help needed with Javascript
 
I need a javascript code to write the id of the div where the code is placed. For example:

<div id="div1"><script type="text/javascript">.....</script></div>
The code will write: div1
And when i change the id of the div the code will write the new id
please help me :)

pdjsolutions 18th November 2009 10:30 AM

Re: Help needed with Javascript
 
document.getElementById("div1").innerHtml = "";

I think that should do.

Am not sure.

Prateek
PDJSolutions

coolboycsaba 18th November 2009 12:49 PM

Re: Help needed with Javascript
 
the problem is i don`t know the div id beacause i want to use this code for comments on a blog , each comment has a different div id

da1fitz 18th November 2009 03:52 PM

Re: Help needed with Javascript
 
Because Js is clientside only and your looking to create a unique reference for each div presumably from different client machines, I think that the only way todo this will be to grab your div number from a database or maybe server based text file using an ajax call, write your div, ++ the div number then write it back to the server once again using an ajax call. As ever nothing is simple :) .


All times are GMT -6. The time now is 02:03 AM.