Forum Moderators: open

Message Too Old, No Replies

Trying to understand how to set variables

         

capulet_x

2:27 am on May 2, 2007 (gmt 0)

10+ Year Member



It should be clear by the script below that I know very little about javascript.

What I am trying to do is replace the URL string that the script is on with the value in a cookie. Why you ask? Because I'm new to javascript and I m trying to learn the syntax and the functions included in this script were of interest to me. Trying little scripts like this help me learn.

I appreciate any help anyone can give me.

<script language=javascript type="text/javascript"><!--
var myvarible = readCookie(myCookie);
s = new String(document.URL);
document.write(s);
document.write("<br>becomes<br>");
s = s.replace(myvarible, document.URL);
document.write(s);
</script>

capulet_x

5:28 pm on May 2, 2007 (gmt 0)

10+ Year Member



...I'll take anything.

rocknbil

9:41 pm on May 2, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Where is your readCookie function? This of course generates an error at readCookie. Open it in FireFox and check out the Javascript Console under the Tools menu. Very helpful.

Also for someone new to Javascript, the alert() function is extremely valuable.

alert(myvariable);