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 3349632
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:41:18+00:00 2026-05-18T01:41:18+00:00

I have a string var x=’abcdefg1234abcdefg’; I want to replace 1234 with 555 using

  • 0

I have a string

var x='abcdefg1234abcdefg';

I want to replace 1234 with 555 using the x.replace() function like

x=x.replace(stuff here)

I tried to pass '1234','555' as the parameters but it’s not working.

Any clues? thanks

Edit:
The string is in a hidden <input> field. The value of it is:

<object id="player" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" name="player" width="400" height="385">
 <param name="movie" value="player.swf" /> <param name="allowfullscreen" value="true" />
 <param name="allowscriptaccess" value="always" />
 <param name="flashvars" value="provider=http&file=files/videos/10.file" />
 <embed type="application/x-shockwave-flash" src="player.swf" width="400" height="385" allowscriptaccess="always" allowfullscreen="true" flashvars="provider=http&file=files/videos/10.file&image=preview.jpg"/>
</object>

I want to replace the width value and the height value to values stored in sb_width and sb_height.

  • 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-05-18T01:41:19+00:00Added an answer on May 18, 2026 at 1:41 am

    What you’ve described should have worked:

    var x = 'abcdefg1234abcdefg';
    x = x.replace('1234', '555');
    alert(x); // alerts abcdefg555abcdefg
    

    But note that replace when given a string will only replace the first one. To replace more, use a regex with the g flag (for “global”):

    var x = 'abcdefg1234abcdefg1234xxx';
    x = x.replace(/1234/g, '555');
    alert(x); // alerts abcdefg555abcdefg555xxx
    

    Live example

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

Sidebar

Related Questions

I have a label function like : private function formatDate (item:Object, column:DataGridColumn):String { var
So I have something like this: var xmlStatement:String = xmlObject.node[3].@thisValue; What mystery function do
I have string like this /c SomeText\MoreText Some Text\More Text\Lol SomeText I want to
Say for example I have the following string: var testString = Hello, world; And
I have string that I want to chop to array of substrings of given
Imagine I have String in C#: I Don’t see ya.. I want to remove
I have a string coming from a table like can no pay{1},as your payment{2}due
I have a string that has some Environment.Newline in it. I'd like to strip
I have a string that contains the representation of a date. It looks like:
Given this string: var str = 'A1=B2;C3,D0*E9+F6-'; I would like to retrieve the substring

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.