Click to See Complete Forum and Search --> : Please help me!!!
rangerstrider9
02-11-2003, 01:50 PM
I have this assignment for class that I need help with. Somebody please help. The link for the assignment is here.
Homework 5 (http://www.cs.fsu.edu/~desmedt/course/intro/homework5)
linnie
02-11-2003, 02:24 PM
You don't describe any particular trouble you're having nor do you ask any particular questions. You make it sound like you want someone to do your homework *for* you. What do *you* learn that way? ...except how to cheat?
So, show us some code and we can help you with particular problems.
Lin
rangerstrider9
02-11-2003, 04:25 PM
Sorry about not listing any specifics. I don't want anyone to do it for me I am just stuck with mainly the first problem. I think I can figure out the rest though. I'm not sure of the structure to put the image on there. The book I have for the class does a ****ty job of explaining. I just need someone to explain to me how I should go about doing this.
Since in your homework assignment it looks like turning to the 'net was allowed for Problem 1...
Does this need to be an <input> area in a form, where users can type in an image name, and type in a width and then (if the image exists) have the image displayed at the width they specified? Or do you simply need to have a link or something that runs the function which will in turn display the image? Either way, it won't be difficult...
Anjuna
02-11-2003, 05:48 PM
function image_im(url,w) {
document.write ("<img src='¨"+url+"' width='"+w+"'>");
}
linnie
02-12-2003, 07:23 AM
Originally posted by rangerstrider9
I don't want anyone to do it for me I am just stuck with mainly the first problem.
Okay, some advice... Since you're going to need a function, I wouldn't use document.write() (because after the page loads, using that will wipe out your page). Instead, use the innerHTML property. For example:
var obj = document.getElementById("divID");
obj.innerHTML = '<img src="' + url + '" width="' + w + '">';
So, as you may be able to tell from looking at the code above, you're going to need a DIV-block in order to receive the information shown. This is what makes it tricky.
Lin
You are definitly right. I was on the forums quite a bit yesterday (I think I had over 40 posts yesterday alone) so often times I don't re-read the whole thread to see what it's about. :( Anyway, I've removed the code, as I too think that students should be doing their own work, otherwise, how will they learn right? Again, thanks for pointing that out.
Anyway, what my main point was was that you could use
document.getElementById("divID").innerHTML = '<img src="'+url+'" width="'+w+'">';
instead of
var obj = document.getElementById("divID");
obj.innerHTML = '<img src="' + url + '" width="' + w + '">';
and since I had made basically the exact code for someone else, I unthinkingly posted the complete code. Glad you caught it so quickly...
Cheers.
linnie
02-12-2003, 08:19 AM
Originally posted by pyro
Anyway, what my main point was was that you could use
document.getElementById("divID").innerHTML = '<img src="'+url+'" width="'+w+'">';
Of course... but because they are a student, I felt splitting it out was more instructive.
Lin
Perhaps, but the only reason that I would actually split it when programming is if I was going to need to reference the ID multiple times...