EdgarsK Posted August 11, 2009 Report Share Posted August 11, 2009 (edited) Sveiki. Mans kods: http://paste.php.lv/...lang=javascript funkcija: Utf8Encode rindiņa: 87. Kļūdas paziņojums: string.replace is not a function ko darīt lietas labā? Edited August 11, 2009 by EdgarsA Quote Link to comment Share on other sites More sharing options...
0 Aleksejs Posted August 11, 2009 Report Share Posted August 11, 2009 string - vispār manuprāt ir rezervētais vārds JavaScriptā, ne? ;) Kas apzīmē datu tipu string... Quote Link to comment Share on other sites More sharing options...
0 bubu Posted August 11, 2009 Report Share Posted August 11, 2009 Javskriptā nav aizliegts rakstīt sekojoši: var string = 123; alert(string); Viss strādās. Problēma visdrīzāk ir tur, kur izsauc Utf8Encode funkciju. Vai tu tai argumentā tiešām padod tādu objektu, kuram ir replace metode? Pamēģini ielikt pirms 87. rindiņas sekojošu kodu: alert(typeof(string)); Quote Link to comment Share on other sites More sharing options...
0 EdgarsK Posted August 11, 2009 Author Report Share Posted August 11, 2009 (edited) hmm . rezūltāts "Object" Neatkarīgi no tā vai tas ir "string" vai "str" vai "my_string" rezūltāts ir vienāds Edited August 11, 2009 by EdgarsA Quote Link to comment Share on other sites More sharing options...
0 bubu Posted August 11, 2009 Report Share Posted August 11, 2009 Tad tas nav strings. Ja tas būtu strings, tad rādītos teksts "string" (bez pēdiņām). Un vispārīgā gadījumā object tipa instancēm nav tādas replace metodes. Skaties uzmanīgāk, ko esi padevis argumentā. Quote Link to comment Share on other sites More sharing options...
Question
EdgarsK
Sveiki.
Mans kods: http://paste.php.lv/...lang=javascript
funkcija: Utf8Encode
rindiņa: 87.
Kļūdas paziņojums: string.replace is not a function
ko darīt lietas labā?
Edited by EdgarsALink to comment
Share on other sites
4 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.