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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:49:07+00:00 2026-06-17T21:49:07+00:00

Here is my script: function createSummaryAndThumb(pID) { var div = document.getElementById(pID); var imgtag =

  • 0

Here is my script:

function createSummaryAndThumb(pID) {
var div = document.getElementById(pID);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length >= 1) {
    imgtag = '<span class="thumbnail pull-left"><img src="' + img[0].srcreplace('/s640/', '/s' + image_size + '/') + '" width="' + img_thumb_width + 'px" height="' + img_thumb_height + 'px"/></span>';
    summ = summary_img;
}

var summary = imgtag + '<p>' + removeHtmlTag(div.innerHTML, summ) + '</p>';
div.innerHTML = summary;
}

The above script will replace /s640 with /image_size. But what can i do so that it change any value of the portion ‘640’. I’ve tried this but it won’t worked-

function createSummaryAndThumb(pID) {
var div = document.getElementById(pID);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length >= 1) {
    if (uh>img_thumb_width) imgtag = '<span class="thumbnail pull-left"><img src="' + img[0].src.replace('/s' + uh + '/', '/s' + img_thumb_width + '/') + '" width="' + img_thumb_width + 'px" height="' + img_thumb_height + 'px"/></span>';
    summ = summary_img;
}

var summary = imgtag + '<p>' + removeHtmlTag(div.innerHTML, summ) + '</p>';
div.innerHTML = summary;
}
  • 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-17T21:49:09+00:00Added an answer on June 17, 2026 at 9:49 pm

    You need to match the number inside with something like:

    replace(/\/s[0-9]+\//, '/s' + image_size + '/')
    

    Here’s an example: http://jsfiddle.net/nfDea/

    Another option is to capture the beginning and end only, in order to concatenate:

    replace(/(\/s)[0-9]+(\/)/, "$1" + image_size + "$2");
    

    http://jsfiddle.net/nfDea/1/

    If you are actually referring to a variable called uh, then you need to use the following:

    var re = new RegExp("/s(" + uh + ")/");
    a = a.replace(re, "/s" + image_size + "/");
    

    http://jsfiddle.net/nfDea/4/

    or

    var re = new RegExp("(/s)" + uh + "(/)");
    a = a.replace(re, "$1" + image_size + "$2");
    

    http://jsfiddle.net/nfDea/3/

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

Sidebar

Related Questions

here is my code.. <script type=text/javascript> function clicker(){ var thediv=document.getElementById('downloadoverlay'); if(thediv.style.display == none){ thediv.style.display
Here is my script: <script type=text/javascript> $(document).ready(function () { $(.div_question).toggle(function () { var answer=
Here is my Javascript... <script type=text/javascript> function validator() { var x = parseInt(document.MyForm.textnuming.value); alert(x);
Here is function , <script type=text/javascript> $(document).ready(function() { getRecordspage(1, 5); $(a.page-numbers).click(function() { alert(1); getRecordspage($(this).text(),
Here is an example: $(function() { $('#test').change(function() { $('#length').html($('#test').val().length) }) }) <script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js></script> <textarea
Here is my code: <script> function loadPage() { function sendFormHelper(callback) { var url =
Here's my script : function itemQuantityHandler(operation, cart_item) { var v = cart_item.quantity; //add one
Here's the script: function runScripts() { if (arguments.length === 0) return; chrome.tabs.executeScript(null, { file:
What's wrong with my jquery script? Here's the script function debug(message){ $(body).append(<div id=\debug\>+ $(message)
So here's my script: function getRandomArrayIndex(source_array) { return Math.floor(Math.random() * source_array.length); } function getRandomArrayEntry(source_array)

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.