JAVA Help 1k

බකුනා

Well-known member
  • Apr 24, 2012
    1,847
    192
    63
    29
    අවතැන් වෙලා ඉන්න
    PHP:
    <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        $img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
     
        $img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
      });
    });
    //]]>
    </script>

    ALT Tag , Title tag දෙක ගන්නෙ ඉමේජ් එකේ නමේ කෑල්ලක් නෙ.. මේකට අපේ කස්ටම් ටෙක්ස් කෑලලක් දාගන්නෙ කොහොමද (හැම ඉමේජ් එකකටම ඒක එන්න)
     

    බකුනා

    Well-known member
  • Apr 24, 2012
    1,847
    192
    63
    29
    අවතැන් වෙලා ඉන්න
    pehedili madi, example ekak kiyapan


    මේ වගේ "my keyword 1" කියන එකක් මැදට දාන්න

    PHP:
    <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        $img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.'))+ my keyword 1);
     
        $img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')) + my keyword 1);
      });
    });
    //]]>
    </script>
     

    u_make_me_sick_

    Well-known member
  • Oct 1, 2011
    11,522
    7,320
    113
    file name alt and title construct karana eka kalin karapan, eeta passe attributes walata add karapan,

    Code:
    var altText = filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.'))+ "my keyword 1";
     $img.attr('title', altText);
     

    Ayeshlive

    Well-known member
  • Jul 1, 2011
    10,570
    943
    113
    *̶͑̾̾​̅ͫ͏̙̤g͛͆̾ͫ̑͆&
    HTML:
    <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        if ($img.attr('title') == undefined) {\
          $img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.'))+ my keyword 1);
        }
       if ($img.attr('alt') == undefined) {\
          $img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')) + my keyword 1);
        }
      });
    });
    //]]>
    </script>
    Script eka oya widihata wenas karaganna. Dan oya script eken alt and title attributes wenas karanne e tag eke alt and title attributes naththam witharai.
    IMG tags danakota me widihata danna:
    HTML:
    <img src="/image.jpg" title="My title" alt="My Alt text">
     
    Last edited:

    බකුනා

    Well-known member
  • Apr 24, 2012
    1,847
    192
    63
    29
    අවතැන් වෙලා ඉන්න
    file name alt and title construct karana eka kalin karapan, eeta passe attributes walata add karapan,

    Code:
    var altText = filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.'))+ "my keyword 1";
     $img.attr('title', altText);

    ඔක තමයි මන්.. ෆුල් කොඩ් එකට ඇඩ් කරල දෙන්න ලුවුන්ද.. ඹන් ඔය ගැන මුකුත් දන්නෙ නෑ:sorry:
     

    බකුනා

    Well-known member
  • Apr 24, 2012
    1,847
    192
    63
    29
    අවතැන් වෙලා ඉන්න
    HTML:
    <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        if ($img.attr('title') == undefined) {\
          $img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.'))+ my keyword 1);
        }
       if ($img.attr('alt') == undefined) {\
          $img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')) + my keyword 1);
        }
      });
    });
    //]]>
    </script>
    Script eka oya widihata wenas karaganna. Dan oya script eken alt and title attributes wenas karanne e tag eke alt and title attributes naththam witharai.
    IMG tags danakota me widihata danna:
    HTML:
    <img src="/image.jpg" title="My title" alt="My Alt text">

    වැඩ නෑනෙ බන්. ටෑග් එකක් හැම එකටම දා න්න් ඔනිද? .. පොස්ට් තියනව 400+ක් වගේ.. ඔටෝ කරගත්තොත් ලෙසියි (ඒවට ටෑග් දාලා නෑ)

    hehce8j.png
     
    Last edited:

    cnk_123

    Well-known member
  • Jun 17, 2008
    1,152
    317
    83
    Image tags godak thiyenawada eka post eke? Ehenam ohoma ekak dala hariyanne nathi wey. Image Tag ekata class ekak daala eeken jQuery Each function eken yawala ooka karapan ethakota hariyay
     

    Ayeshlive

    Well-known member
  • Jul 1, 2011
    10,570
    943
    113
    *̶͑̾̾​̅ͫ͏̙̤g͛͆̾ͫ̑͆&
    බකුනා;17993513 said:
    වැඩ නෑනෙ බන්. ටෑග් එකක් හැම එකටම දා න්න් ඔනිද? .. පොස්ට් තියනව 400+ක් වගේ.. ඔටෝ කරගත්තොත් ලෙසියි (ඒවට ටෑග් දාලා නෑ)

    hehce8j.png
    moakakda hariyatama wenna one kiyanna.
     

    බකුනා

    Well-known member
  • Apr 24, 2012
    1,847
    192
    63
    29
    අවතැන් වෙලා ඉන්න
    moakakda hariyatama wenna one kiyanna.

    PHP:
    <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        $img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
     
        $img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
      });
    });
    //]]>
    </script>
    මේ කොඩ් එක දෑවම ඔටෝ ටෑග් වැටෙනව ටයිටල් එකයි ඒ එල් ටී එකයි ඉමේජ් එක්කොමට (ඉමේජ් එකේ නේම් එක වැටෙන්නෙ) කෝඩ් එකේ අවුලක් නෑ මට ඕන පොඩ්ඩක් වෙනස් කරගන්න

    ඹට ඕන මගේ සයිට් එකේ මේන් කී වර්ඩ් එකත් ඒකත් එක්ක TITLE එකට & ALT එඑකට දාගන්න

    ex . title="image_name elakiri" alt="image_name elakiri"

    image_name කියන එක අර කොඩ් එකෙන් වැටෙනව.. එලකිරි කියල තනි කීවඩ් එකත් දාගන්න ඕන
     
    Last edited:

    Ayeshlive

    Well-known member
  • Jul 1, 2011
    10,570
    943
    113
    *̶͑̾̾​̅ͫ͏̙̤g͛͆̾ͫ̑͆&
    බකුනා;17993568 said:
    PHP:
    <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        $img.attr('title', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
     
        $img.attr('alt', filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')));
      });
    });
    //]]>
    </script>
    මේ කොඩ් එක දෑවම ඔටෝ ටෑග් වැටෙනව ටයිටල් එකයි ඒ එල් ටී එකයි ඉමේජ් එක්කොමට (ඉමේජ් එකේ නේම් එක වැටෙන්නෙ) කෝඩ් එකේ අවුලක් නෑ මට ඕන පොඩ්ඩක් වෙනස් කරගන්න

    ඹට ඕන මගේ සයිට් එකේ මේන් කී වර්ඩ් එකත් ඒකත් එක්ක TITLE එකට & ALT එඑකට දාගන්න

    ex . title="image_name elakiri" alt="image_name elakiri"

    image_name කියන එක අර කොඩ් එකෙන් වැටෙනව.. එලකිරි කියල තනි කීවඩ් එකත් දාගන්න ඕන

    Machan ekama keyword eka hama thanatama daana ekanam mama recommend karanne naha. ANiwa keyword polluting walata mattu wenawa.


    PHP:
    <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      var head_title = $(document).find("title").text(); // Keep this line to get it from the title tag.
      var head_title = 'Some text'; //OR hardcode it. 
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        var alttitle = ' ' + filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.'))+ head_title;
        $img.attr('title', alttitle).attr('alt', alttitle);
    
      });
    });
    //]]>
    </script>

    Uda thiyena code eke
    Code:
    var head_title = 'Some text'; //OR hardcode it.
    kiyana kotasa delete karoth page eke <title></title> tag eke thiyena title eka auto use karanawa.

    Naththam
    Code:
    var head_title = $(document).find("title").text(); // Keep this line to get it from the title tag.
    Kiyana line eka delete karala "Some text" kiyana thanata danna oyata one keywords.
     

    Sandaru Kalhara

    Well-known member
  • Apr 15, 2014
    1,124
    159
    63
    ayeshlive දාල තියෙන කෝඩ් එකෙන් උබට ඕන දේ වෙනව. ඒ වගේ ම අයේෂ් කිව්ව වගේ එකම කීවර්ඩ් එක හැම ඉමේජ් එකටම උබන්න යන්න එපා ඒක හොඳ ප්‍රැක්ටිස් එකක් නෙමේ මචං...

    මම අයේෂ් ගේ කෝඩ් එක පොඩ්ඩක් ට්වීක් කරා. කීවර්ඩ් දෙක සෙපරේට් වෙන්න සහ පල‍වෙනි වර්ඩ් එකේ මුල තියෙන වයිට් ස්පේස් එක නැති කරන්න...

    PHP:
        <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      var head_title = $(document).find("title").text(); // Keep this line to get it from the title tag.
      var head_title = 'Some text'; //OR hardcode it. 
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        var alttitle = '' + filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')) + ' ' + head_title;
        $img.attr('title', alttitle).attr('alt', alttitle);
    
      });
    });
    //]]>
    </script>
     

    බකුනා

    Well-known member
  • Apr 24, 2012
    1,847
    192
    63
    29
    අවතැන් වෙලා ඉන්න
    ayeshlive දාල තියෙන කෝඩ් එකෙන් උබට ඕන දේ වෙනව. ඒ වගේ ම අයේෂ් කිව්ව වගේ එකම කීවර්ඩ් එක හැම ඉමේජ් එකටම උබන්න යන්න එපා ඒක හොඳ ප්‍රැක්ටිස් එකක් නෙමේ මචං...

    මම අයේෂ් ගේ කෝඩ් එක පොඩ්ඩක් ට්වීක් කරා. කීවර්ඩ් දෙක සෙපරේට් වෙන්න සහ පල‍වෙනි වර්ඩ් එකේ මුල තියෙන වයිට් ස්පේස් එක නැති කරන්න...

    PHP:
        <script type='text/javascript'>
    //<![CDATA[
    $(document).ready(function() {
      var head_title = $(document).find("title").text(); // Keep this line to get it from the title tag.
      var head_title = 'Some text'; //OR hardcode it. 
      $('img').each(function(){
        var $img = $(this);
        var filename = $img.attr('src')
        var alttitle = '' + filename.substring((filename.lastIndexOf('/'))+1, filename.lastIndexOf('.')) + ' ' + head_title;
        $img.attr('title', alttitle).attr('alt', alttitle);
    
      });
    });
    //]]>
    </script>

    thanks ban :D

    rep denna baalu :/