473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Adding Image to an Output.

I am writing a birthday list for a site for my school. While developing it. Currently the code for the output of birthdays is:
<html><head>
<title>Birthday List</title><script type="text/javascript">
var arrBday = [
['John Doe', '6/4'],
['Marge Smith', '6/12'],
['Homer Simpson', '6/14'],
['Bart Simpson', '6/14'],
['Peter Griffin', '6/15'],
['Kenny McCormick', '6/17'],
['Eric Cartmen', '6/24'],
];

function getBdaysThisWeek(){
var arrMonth = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
var bday, idx;
var bdayList = new Array();
var today = new Date();

for (var i=0;i<arrBday.length;i++){
var bday = new Date(arrBday[i][1] + '/' + today.getFullYear());
if (isNaN(bday)) continue;

if ( isBdayInRange(bday, 7) ){
idx = bdayList.length;
bdayList[idx] = new Object();
bdayList[idx].name = arrBday[i][0];
bdayList[idx].bday = bday;
bdayList[idx].month = arrMonth[bday.getMonth()];
}
}
if (bdayList.length > 0){ //sort asc by birthdate
bdayList.sort(
function(a, b){
if (a.bday < b.bday) return -1
if (a.bday > b.bday) return 1;
return 0;
}
);
}
return bdayList;
}

function isBdayInRange(bday, interval){
//credit for this function goes to:
//-Rob (@slingfive) Eberhardt, Slingshot Solutions
//http://slingfive.com/pages/code/jsDate/jsDate.html
var today = new Date();
today.setHours(0,0,0,0);
//if the birthday has already occurred in the year, increment to the next year
if (bday < today)
bday.setFullYear(bday.getFullYear() + 1);

// get ms between dates (UTC) and make into "difference" date
var iDiffMS = bday.valueOf() - today.valueOf();
//divide iDiffMS by 1000, Seconds, Minutes, Hours
nDays = parseInt(iDiffMS / 1000 / 60 / 60 / 24);

if(parseInt(nDays) <= parseInt(interval))
return true;
else
return false;
}

function displayBdayList(){
var date = new Date().getDate();
var bdayList = getBdaysThisWeek();
var len = bdayList.length;
var s = "<h2><center>Happy Birthday!!</center></h2>";
if (len>0){
s += '<ul>';
for (var i=0; i<len; i++){
//be mindful of the string-line continuation character (\) at the end of the first line
s += '<li' + ((date == bdayList[i].bday.getDate())?' class="bdayToday"':'')+ '>\
<strong>' + bdayList[i].name + '</strong> - '
+ bdayList[i].month + ' ' + bdayList[i].bday.getDate() + '</li>';
}
s += '</ul>';
}
else{
s += "No birthday celebrant for this week.";
}
document.write(s);
}
</script>
<style type="text/css">
body {
font:14px Verdana;
}
/*display style when bday is today*/
.bdayToday {
color: red;
}
</style></head>
<body>
<script type="text/javascript">
displayBdayList();
</script></body></html>
We have a file with the pictures of everyone on the same site saved as "http://www.site.com/site/pictures/LastName_FirstName.jpg"

with the output, is it possible for me to pull the information bout the names and use it to add a picture of the people underneath their names....without writing out everyone by hand?
Jun 14 '07 #1
3 1983
iam_clint
1,208 Expert 1GB
why don't you use serverside programming and database for this?

anyways yes you can.
Jun 14 '07 #2
why don't you use serverside programming and database for this?

anyways yes you can.
I wouldn't know how to while sitting on a Share Point site.
Jun 18 '07 #3
acoder
16,027 Expert Mod 8TB
We have a file with the pictures of everyone on the same site saved as "http://www.site.com/site/pictures/LastName_FirstName.jpg"

with the output, is it possible for me to pull the information bout the names and use it to add a picture of the people underneath their names....without writing out everyone by hand?
Say you have the name stored in a variable 'name'. Split the name so that you can swap the first and last name. Then you can just put an image using, e.g.:
Expand|Select|Wrap|Line Numbers
  1. var nameArr = name.split(" ");
  2. document.write("<img src='"+urltosite+nameArr[1]+"_"+nameArr[0]+".jpg'>");
Jun 19 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Kingdom | last post by:
I'm using this script to dynamicaly populate 2 dropdowns and dispaly the results. Choose a component type from the first drop down, lets say 'car' and the second box will list all the car...
2
by: cjl | last post by:
Hey all: I have a div of a known size, 672px X 672px. In it I will display images that are of unknown size. I have two simple functions that shrink and center the image: function shrink() {...
0
by: Anonieko Ramos | last post by:
> I have a graphics images that I want to convert to > ASCII art. How do I do it? > Code: - Default.aspx.cs
6
by: Richard | last post by:
On my webpage I am making I want that if users view any image in my gallery a small logo/tekst will appear in the image. I know it's possible but I haven't got a clue how to get a logo or tekst on...
7
by: Adam Maltby | last post by:
Hi, I am adding an new picbox and animated gif to it at runtime Dim img As Image = Image.FromFile(Application.StartupPath & "\animation.gif") With pic_Wait .Location = New Point(300, 250)...
0
by: bearophileHUGS | last post by:
Hello, this time I have a question about PIL usage, maybe if Lundh has some time he can answer me. I am experimenting different color quantization algorithms, so having computed the palette with a...
4
by: tshad | last post by:
I am trying to set up an Image authorization where you type in the value that is in a picture to log on to our site. I found a program that is supposed to do it, but it doesn't seem to work. ...
5
by: Ricardo Furtado | last post by:
I'm trying, for a week or two, to create a procedure in order to rotate the image in any picturebox control in a cephalometry software. I've found a web site that shows how that can be done:...
8
by: Alexander Fischer | last post by:
Hello, I am writing a gallery script and use imagecreatefromjpeg and fpassthru to output images without any change to them (i.e., no thumbnail creation etc. - just deliver the image via the php...
5
by: DBC User | last post by:
I have a situation, where I need to add 4 or 5 data files (they change every time I build) in my project during build time and somehow I need a way to access these files during runtime. So I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.