Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7763387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:38:46+00:00 2026-06-01T14:38:46+00:00

I run next code and I miss somthing, for me it seem OK :

  • 0

I run next code and I miss somthing, for me it seem OK :

window.onload = TitleFieldInit;
function TitleFieldInit() {
    var str = document.cookie.split("=")[1];
    var space = str.split("=")[1];
    space = space.split(";")[0];
    alert(space);
    // while( space.indexOf('%20' )+1) space = space.replace(/%20/,' ');
    if (document.cookie != "") {
        document.getElementById("TitleField").innerHTML = "Your Title is : " + space;
    }
}​

and I got err in FireFox rror”space is undefined” why ?
In chrome “Uncaught TypeError:Cannot call method’split’ of Undefined”
Thx for helping.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T14:38:47+00:00Added an answer on June 1, 2026 at 2:38 pm

    This code will never work for any input.

    str is a already part of result of split by =, i.e. it contains no = symbols.

    Then you split that result again by =, which of course will return you one-element array and str.split("=")[1] will always be undefined.

    Looks like you’re trying to read cookie value… but second .split("=") is not needed at all.

    Ah, and you got different results in different browsers, cause they contain different data in their cookies.

    PS: Instead of while( space.indexOf('%20' )+1) space = space.replace(/%20/,' '); you may write space = space.replace(/%20/g,' '); to replace all of them at once.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I run my code I'm facing the next 2 errors: mysql_num_rows() expects parameter
I have a fairly simple block of code. Sub Run(Name) on error resume next
If I run next saturday into strtotime function it shows 4/3/2010 as the date.
When I try to run .aspx page with next code: System.IO.File.Delete(~/img/afisha/ + fileName); it
I have the next query that I run via SQLCMD.EXE use [AxDWH_Central_Reporting] GO EXEC
I have the next code ProgressDialog pd; LinearLayout layout; ListView listview; TextView name[]; TextView
suppose we have this next sample code: while(some condition){ lock1.lock(); . . } the
the next is my code: class foo: def __init__(self): self.a = a def __getattr__(self,x,defalut):
There should be an error/omission in the next code but I can't see where
I need to create an executable from the next assembly code: .MODEL SMALL .DATA

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.