Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post If javascript result like...then...

    Hi,

    I want to change the code, if the result like some strings, then change to another strings,

    can someone help me ?


    <script language="JavaScript" src="http://www.fishinghk.com/addon/feed2js/feed2js.php?
    src=http://rss.weather.gov.hk/rss/WeatherWarningBulletin_uc.xml&num=1&desc=1&utf=y" charset="UTF-8" type="text/javascript"></script>


    Many thanks!!

  2. #2
    Master Coder sunfighter's Avatar
    Join Date
    Jan 2011
    Location
    Washington
    Posts
    7,689
    Thanks
    34
    Thanked 1,039 Times in 1,035 Posts
    Do you mean this
    <script></script>
    ?
    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.

  3. #3
    New to the CF scene
    Join Date
    Jun 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    Do you mean this
    <script></script>
    ?
    I mean...for explame...if the script show the result is like"good", so change the result strings to null

  4. #4
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    3,281
    Thanks
    1
    Thanked 558 Times in 544 Posts
    Hi there naobao,

    using this....

    Code:
    
    <script src="http://www.fishinghk.com/addon/feed2js/feed2js.php?src=http://rss.weather.gov.hk/rss/WeatherWarningBulletin_uc.xml&num=1&desc=1&utf=y"></script>
    
    ...produces this...

    Code:
    
    feed2js_ck = true;
    
    document.write('<div class="rss-box">');
    document.write('<ul class="rss-items">');
    document.write('<li class="rss-item"><a class="rss-item" href="http://www.weather.gov.hk/textonly/warning/detailc.htm" target="_self">有關酷熱天氣警告的資訊 (2018 年 06 月 26 日 14 時 40 分)</a><br />');
    document.write('香港天文台在下午2時40分發出酷熱天氣警告。天文台預料今明兩日本港天氣酷熱,市民應提高警惕,以防中暑。在戶外工作或活動的人士,應多喝水和不要過度勞累。於感覺不適時,應盡快到陰涼的地方休息。在沒有空調設備室內的人士,應盡量打開窗戶以保持空氣流通。避免長時間在陽光下曝曬,以免受太陽紫外線曬傷。應穿上鬆身衣服以及配戴適當帽子和能阻隔紫外線的太陽眼鏡。泳客或在戶外遊玩的人士應重複塗抹防曬系數15或以上的太陽油。請關注長者或慢性病患者的健康狀況。如認識他們,請間中致電或探訪他們,看看是否需要提供幫助。以上天氣稿由天文台 2018 年 06 月 26 日 14 時 40 分發出');
    document.write('</li>');
    document.write('</ul></div>');
    I do not see anything that you could edit in the manner that you suggest.

    For those who may be interested in the latest Hong Kong weather here
    is the Google translation...

    Code:
    
    <div class="rss-box">
     <ul class="rss-items">
      <li class="rss-item">
       <a class="rss-item" href="http://www.weather.gov.hk/textonly/warning/detailc.htm" target="_self">
        Information on the hot weather warning (06.20 on June 26, 2018) The
       </a>
        <br>
         hot weather warning is now in effect. The Hong Kong Observatory anticipates that the weather in 
         Hong Kong will be very hot in the next few days. The public should be vigilant to prevent heat 
         stroke. People who work or exercise outdoors should drink plenty of water and do not overwork. 
         When you feel unwell, you should rest in a cool place as soon as possible. People without 
         air-conditioned rooms should try to open windows to keep the air flowing. Avoid prolonged 
         exposure to sunlight to prevent sunburn from UV rays. Wear loose clothing and wear appropriate 
         hats and sunglasses that block ultraviolet light. Bathers or people who play outdoors should 
         apply sun oil with a sun protection factor of 15 or more. Please pay attention to the health 
         status of the elderly or the chronically ill. If you know them, please call or visit them to 
         see if you need help. The weather report above was issued by the Observatory at 16:20 on 
         26 June 2018.
      </l1>
     </ul>
    </div>

    coothead
    Last edited by coothead; Jun 26th, 2018 at 09:32 AM.
    ~ the original bald headed old fart ~

  5. #5
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    2,998
    Thanks
    3
    Thanked 427 Times in 416 Posts
    I cannot figure out for the life of me what's actually being asked here... but this is isn't 1998 you don't say language="JavaScript" anymore, this isn't 2003 you don't say type="text/javaScript" anymore, you don't generally declare the charset on the SCRIPT tag, and your URI's "getData" isn't properly entity encoded.

    But seriously, could you better explain what you're asking as so far you've posted complete gibberish.

    Though that script using document.write is a train wreck laundry list of how NOT to write JavaScript... 1990's style trash.
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture
    http://www.cutcodedown.com

  6. #6
    New to the CF scene
    Join Date
    Jun 2018
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank so much!!


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •