WordPress.org

Ready to get started?Download WordPress

Forums

Convert Javascript script to widget (1 post)

  1. Dolomats0
    Member
    Posted 1 year ago #

    Hello

    so i just custumised a javascript script that is showing Prayers Time
    i m trying to insert it into my website but dosent work
    her is what i did :
    insert the link for the script on the header :
    <script src="http://actionprofessionnelle.com/wp-content/plugins/prayer-time/PrayTimes.js" type="text/javascript"></script>

    and puted the javascript code on the text widget :

    `<div id="table"></div>
    <script type="text/javascript">

    var date = new Date(); // today
    var times = prayTimes.getTimes(date, [33.533333, -7.583333], 0);
    var list = ['Fajr', 'Sunrise', 'Dhuhr', 'Asr', 'Maghrib', 'Isha'];

    var html = '<table id="timetable" border="1">';
    html += '<tr><td colspan="2">'+ date.toLocaleDateString()+ '</td>';
    html += '<td rowspan="7" id="bkg"><img src="Mosquee-Hassane-II-Casablanca.jpg" width="170" height="200" /></td></tr>';
    for(var i in list) {
    html += '<tr><td>'+ list[i]+ '</td>';
    html += '<td>'+ times[list[i].toLowerCase()]+ '</td></tr>';

    }
    html += '</table>';
    document.getElementById('table').innerHTML = html;

    </script>`

    so if samone can tell me how can i deal with this to make it work
    or if it s possible that i give you the script it s only 2 files
    .js & .html and make a widget from it !!!!

    thanks

    Script Link : actionprofessionnelle.com/pt/PrayerTimes.html

Topic Closed

This topic has been closed to new replies.

About this Topic