inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jul 19, 2012 12:53:31 GMT -8
How would you go about adding something after an entire element? Mainly in my case an input area.
|
|
inherit
126477
0
Apr 21, 2023 15:18:52 GMT -8
Shrike
Re-appeared briefly after 6 years only to no doubt disappear again.
1,569
June 2008
shrike
|
Post by Shrike on Jul 19, 2012 14:11:48 GMT -8
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jul 19, 2012 14:27:17 GMT -8
Okay. Thanks
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jul 20, 2012 7:46:44 GMT -8
Thank you. That was actually a lot easier than expected. Thanks again.
Here's what I did with it. Not exactly sure how useful it would be, but it was an idea I had and I felt I should go with it. lol
<script type="text/javascript">
var staff = "admin"; //separate by a comma
if(pb_action == 'pmsend'){ var staffButton = document.createElement("input") var toIn = document.getElementsByName("to")[0]; staffButton.setAttribute("type","button"); staffButton.setAttribute("onClick","showStaff()"); staffButton.setAttribute("value","PM Staff"); var parentDiv = toIn.parentNode; parentDiv.insertBefore(staffButton, toIn.nextSibling); } function showStaff() { document.postForm.to.value = staff; } </script>
Edit to add, that this does not work in IE. The only problem is with the adding the staff names to the input.
|
|
inherit
24252
0
Aug 1, 2023 15:01:24 GMT -8
coolcoolcool
When the world says, "Give up," Hope whispers, "Try it one more time."
2,148
May 2004
coolcoolcool
|
Post by coolcoolcool on Jul 20, 2012 19:33:14 GMT -8
Nice script . By the way, if you ever find you're finding a lot of uses for insertAfter, you could always make a user defined function for it. Just do something like the following. var insertAfter = function(newElem, oldElem) { return oldElem.nextSibling ? oldElem.parentNode.insertBefore(newElem, oldElem.nextSibling) : oldElem.parentNode.appendChild(newElem); }; Then you can just do insertAfter(document.createTextNode("sup"),document.getElementsByTagName("font")[2]); or whatever you feel like.
|
|
inherit
170346
0
Mar 1, 2016 12:53:37 GMT -8
Shorty
Yeah, I'm that cool. Lol! No I'm not.
3,018
August 2011
shortyverrett94
|
Post by Shorty on Jul 20, 2012 22:20:55 GMT -8
Okay cool thanks!!!
|
|