| | |
opening pictures in a new window
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
i signed up to daniweb a few weeks ago when i was having problems with visual basic which after a lot of searching on google i managed to solve for myself. i am now having a go at building a website and have been using dreamweaver which makes things very simple to achieve while i'm still learning how to html works.
i have put some of my photos on one of the pages and i have been trying to go from clicking on a thumbnail to opening a new small window containing a bigger picture. i realised from studying the source code of other websites that do this that i needed to use javascript but i have been having trouble finding something that works properly in firefox and ie (i am using ie7 if it matters). when you click on one of the thumbnails eg: the picture of a lorry on http://www.fieryidris.co.uk/Pictures...stingLorry.htm the new window opens with the bigger picture but then continues 'thinking' even when all of the picture is loaded.
i lifted the javascript code from another website so i don't completely understand it ,i can see that it is controlling the size and appearance of the new window , but there is also a random math bit i'm not sure what that does?
is there something i need to add to the javascript code to make the new window stop saying 'transferring data from www.fieryidris.co.uk ' or have i used some rubbish javascript and need to use a different javascript?
i have put some of my photos on one of the pages and i have been trying to go from clicking on a thumbnail to opening a new small window containing a bigger picture. i realised from studying the source code of other websites that do this that i needed to use javascript but i have been having trouble finding something that works properly in firefox and ie (i am using ie7 if it matters). when you click on one of the thumbnails eg: the picture of a lorry on http://www.fieryidris.co.uk/Pictures...stingLorry.htm the new window opens with the bigger picture but then continues 'thinking' even when all of the picture is loaded.
i lifted the javascript code from another website so i don't completely understand it ,i can see that it is controlling the size and appearance of the new window , but there is also a random math bit i'm not sure what that does?
is there something i need to add to the javascript code to make the new window stop saying 'transferring data from www.fieryidris.co.uk ' or have i used some rubbish javascript and need to use a different javascript?
i know your probably going to think i'm a right idiot but i keep adding the document.close() to different places at or near the end of the javascript and i still can't get it right, it seems to work fine inside my computer but once it is uploaded to the server it still says 'transferring data from www.fieryidris.co.uk ' all the time. could you please edit the script below so i can see what it should be?
function imgOpen(imgS, width, height) {
rand_id='image'+(Math.round(Math.random()*100000));
outf="<html><head><style>body{margin:0px;}</style></head><body leftmargin=0 topmargin=0><img src=\""+imgS+"\"></body></html>";
iopen="iwin=self.open('"+imgS+"', '"+rand_id+"', 'width="+width+", height="+height+",toolbar=0,resizable=0');"+
"iwin.document.write('"+outf+"');"+"iwin.focus();";
eval(iopen);
}
function imgOpen(imgS, width, height) {
rand_id='image'+(Math.round(Math.random()*100000));
outf="<html><head><style>body{margin:0px;}</style></head><body leftmargin=0 topmargin=0><img src=\""+imgS+"\"></body></html>";
iopen="iwin=self.open('"+imgS+"', '"+rand_id+"', 'width="+width+", height="+height+",toolbar=0,resizable=0');"+
"iwin.document.write('"+outf+"');"+"iwin.focus();";
eval(iopen);
}
•
•
Join Date: Dec 2004
Posts: 1,655
Reputation:
Solved Threads: 35
function imgOpen(imgS, width, height) {
rand_id='image'+(Math.round(Math.random()*100000));
outf="<html><head><style>body{margin:0px;}</style></head><body leftmargin=0 topmargin=0><img src=\""+imgS+"\"></body></html>";
iopen="iwin=self.open('"+imgS+"', '"+rand_id+"', 'width="+width+", height="+height+",toolbar=0,resizable=0');"+
"iwin.document.write('"+outf+"');iwin.document.close();"+"iwin.focus();";
eval(iopen);
}
rand_id='image'+(Math.round(Math.random()*100000));
outf="<html><head><style>body{margin:0px;}</style></head><body leftmargin=0 topmargin=0><img src=\""+imgS+"\"></body></html>";
iopen="iwin=self.open('"+imgS+"', '"+rand_id+"', 'width="+width+", height="+height+",toolbar=0,resizable=0');"+
"iwin.document.write('"+outf+"');iwin.document.close();"+"iwin.focus();";
eval(iopen);
}
![]() |
Similar Threads
- Opening IE6 links on new window is slow (Windows NT / 2000 / XP)
- can't open new browser window on aol (Web Browsers)
- Opening a Web Page in a New Window (Windows tips 'n' tweaks)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Page Opening - Cache Problem?
- Next Thread: Counter
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxhelp animate array automatically beta box bug calendar cart checkbox class codes column cookies createrange() css cursor date debugger decimal design dom download dropdown editor element enter error events explorer firefox focus form frameworks getselection google gwt html htmlform iframe image() images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jsp listbox maps masterpage math menu microsoft mimic mp4 object onmouseover parent php player post problem programming progressbar prototype rating redirect regex runtime safari scale scriptlets search select session shopping size sql starrating stars text textarea toggle validation variables w3c website window windowofwords windowsxp wysiwyg xml \n






