...

View Full Version : Help with error when using string methods



marcas91
08-19-2007, 06:35 PM
I have a code (actually a two-part one) that (tries to) take a link, save it in a session cookie, redirects to a page where the following code is located and then add part of one link with part of another.

The problem I'm having is with some string methods (particularly slice/substring). Firefox says both of them are not functions:



<head>

<script>

<!--

function viewhiddenstuff(){

var cookielink=document.cookie

var urlnum=cookielink.indexOf("marcasurl=")

var seminum=cookielink.indexOf(";",urlnum)

var urlstart=urlnum+10

var geturl=cookielink.substring(urlstart,seminum)

var friendnumber=geturl.indexOf('friendid')

var fidstart=friendnumber+9

var friendid=fidstart.substring(0,9)

var commentslink="http://comment.myspace.com/index.cfm?fuseaction=user.viewComments&friendID=";

var friendslink="http://friends.myspace.com/index.cfm?fuseaction=user.viewfriends&friendID=";

var which=window.confirm("Click OK to view hidden comments \n Click CANCEL to view hidden friends")

if (which){
window.location=commentslink+friendid}

if (!which){
window.location=friendslink+friendid}

}

//-->

</script>
</head>

<body>
<script>
<!--
viewhiddenstuff();
//-->
</script>

<center><BR><BR><BR><BR><BR><BR><BR><font size=6 color=red font=arial>Loading applet</font></center>
</body>


If it's of any help it neither works on Safari nor on Firefox (OS X 10.4)

The point is to take the friendid from a myspace URL, add it to the rest of another link to view comments on people's pages where they are hidden, and navigate to the makeshift link.

marcas91
08-19-2007, 06:58 PM
I thought I had something in there that I didn't...thought I wasn't approaching the method correctly but the reason is I was trying to "slice" a number instead of a string.

sorry for wasting your time.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum