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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T10:10:21+00:00 2026-06-08T10:10:21+00:00

my question is I need to create a string from the result of event.content.

  • 0

my question is I need to create a string from the result of event.content. Event.content returns me an entry including html tags. I can use it like container.innerHTML = event.content. I need the event.content as a string. I tried to do something like this:

var a = '' + event.content;

But it doesn’t work. Here the result of event.content:

<img src="http://image.weather.com/web/common/wxicons/31/30.gif?12122006" alt="" />Partly Cloudy, and 84 &deg; F. For more details?

I can’t convert this into string in javascript. Is it possible? I also tried String(event.content). Ok I put my whole code.

 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>  
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>Hava Durumu</title>  

 <script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">

  google.load("feeds", "1");
function havabas(){

   var feed = new google.feeds.Feed("http://rss.weather.com/weather/rss/local/TUXX0014? cm_ven=LWO&cm_cat=rss&par=LWO_rss");
  feed.load(function(result) {
    if (!result.error) {
        var entry = result.feed.entries[0];
        var container = document.getElementById("weather");
        var c = entry.content;

        var regex = /<img.*?src="(.*?)".*?>.*?([0-9]+\s*&deg;)/;
        var results = regex.exec(entry.content);
        var html = '<img src= ' + results[1] + ' alt="" /> ' + results[2];

      container.innerHTML = html;

    }
  });
}

function initialize() {
havabas();
setInterval(function(){havabas()},2000);
}
google.setOnLoadCallback(initialize);

</script>
</head>
<body>
<div id="weather"></div>
</body>
</html>
  • 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-08T10:10:23+00:00Added an answer on June 8, 2026 at 10:10 am

    Your regex is invalid. It does not match the string from entry.content. The reason for this is &deg;. Change your code to this:

    var regex = /<img.*?src="(.*?)".*?>.*?([0-9]+)/;
    var results = regex.exec(entry.content);
    var html = '<img src= ' + results[1] + ' alt="" /> ' + results[2] + ' &deg;';
    

    DEMO

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

Sidebar

Related Questions

This is a design question: when do I need to create/use a static method
Question: I need to call a C# dll from a C++ executable. I use
For the purpose of the question I need to create a simple fictitious scenario.
Following my previous question , I need to create a value consisting of a
According to this question I succeeded to create upload image, but now I need
Simple question: I need a solution so that I can find, lets say names,
I've this question from an assignment to create a Store which rent out books,
Question: I need a DragAndDrop solution to download a file on drop in a
Question: I need to get the DATE ONLY (= date WITHOUT time) with an
Core Question I need help coming up with a concept to achieve my goal.

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.