Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> My Little Javascript, Need Some Debugging Help
Sharn
post Dec 6 2006, 04:45 PM
Post #1


Member [Level 2]
*****

Group: Members
Posts: 89
Joined: 26-August 06
Member No.: 28,938



Ok, to start, the purpose of the script. I'm trying to make a script that puts a link on every page on an Invisionfree forum (IPB 1.3) that takes you to a thread and automatically put in the url from which you clicked. I already have the whole thing working, but when I go to edit my signature, it inputs most of the url into the box. It replaces my whole sig with that, so it's a big problem.

The code:
CODE

This part makes the link on every page.
<script LANGUAGE="JavaScript">  
           <!--
           document.write('<A HREF="http://z14.invisionfree.com/worknplay/index.php?act=Post&CODE=02&f=25&t=31&Post=' + location.href +'">');
           document.write('Report Topic');
           document.write('</A>');
           // -->
</SCRIPT>


CODE

This part inputs the url variable into the post box.
<FORM NAME="Post">
<INPUT TYPE="hidden" NAME="Posturl">
</FORM>

<script LANGUAGE="javascript">

var locate = window.location
document.Post.Posturl.value = locate

var text = document.Post.Posturl.value

function delineate(str)
{
theleft = str.indexOf("Post=") + 5;
theright = str.lastIndexOf("&");
return(str.substring(theleft, theright));
}

function delineat(str)
{
theleft = str.indexOf("showtopic=") + 10;
theright = str.lastIndexOf("&");
return(str.substring(theleft, theright));
}

if(delineat(text) == "31")
{
eval('document.REPLIER.Post.value = delineate(text)');
}
</SCRIPT>  


So the idea is to report a thread if it is spam. It brings you to a thread made for reporting them and automatically puts the URL of the bad thread in. As I said, when the "Post" variable is passed in the url, it works fine for it's purpose. However, if there is no Post variable in the url it reports everything after http (IE ://z14.invisionfree.com/worknplay/index.php?act=Post&CODE=02&f=26)

I just realised it did that to every post, and not just the signature. The thread I would like it to report into is "http://z14.invisionfree.com/worknplay/index.php?act=Post&CODE=02&f=26&t=7", how would I get that if... loop to work to only make it put in the text in that certain thread? I'm new to Javascript, so I'm not sure how to use if statements with a str. =\

EDIT: Mmk, I got it to where it would only put it in one url, but that url just so happens to change for every topic. So what I need is some sort of wildcard after
"http://z14.invisionfree.com/worknplay/index.php?showtopic=31&st=0&#last"
So it will enter the URL only on that thread.

Second edit: All right, I got it completely figured out. If anyone wants the code for whatever reason, feel free to PM me...

This post has been edited by Sharn: Dec 7 2006, 01:56 AM
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Javascript Slideshow Tutorial(7)
  2. Javascript Close Window(15)
  3. One Click Copy And Paste To Clipboard(5)
  4. Adding Rows & Columns In Html Table Using Javascript(1)
  5. I'm Making My Own Javascript Only Rpg :d(7)
  6. What's The Relationship Between Javascript And Java(7)
  7. Javascript : No Right Click Script !@(12)
  8. Hiding <div> Boxes With Javascript(8)
  9. How Do You Make A Javascript Calculator?(11)
  10. Great Javascript Script Source(2)
  11. Web Applications: J2ee Or Javascript/css/html(1)
  12. Opera Browser + Javascript + Embeded Sound(0)
  13. Javascript - What's Your Browser?(3)
  14. Javascript Events Not Working For Ie(6)
  15. I`m New To Javascript.(5)
  1. Ajax Code Need Help Debugging.(9)
  2. Special Wii Javascript(2)
  3. Javascript Error(2)
  4. Is It Possible To Create A Web Based Mmo In Javascript?(4)
  5. Capturing Username Of Computer(3)
  6. Javascript Object Node Referencing Help(5)
  7. Flash And Javascript Interaction(1)
  8. Document.write & Noscript Questions (javascript)(2)
  9. Java Vs Javascript(11)
  10. Adjusting Rows/cols Of Frames In Frameset Using Javascript Is Not Working In Firefox 3 Is Not Working(4)
  11. Need Help With Javascript Drag And Drop Script(2)
  12. Re-learning Javascript(3)
  13. Javascript Game(6)


 



- Lo-Fi Version Time is now: 22nd November 2008 - 02:58 AM