4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 JavaScript OnClick problems!!!!
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Gary
Junior WebHelper
Junior WebHelper


Joined: 30 Apr 2003
Posts: 21
Location: the UK, Devon

PostPosted: Wed Mar 03, 2004 11:18 pm (20 years, 1 month ago) Reply with QuoteBack to Top

Hey all, i want this code to open a window of a certain size... so i was told to do this:

Quote:
<SCRIPT language=JavaScript>
<!--
function click()
{
window.open("http://www.dontstop.co.uk/v2/atb/html_files/lyrics-music-inlovewiththedj.htm","click1","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=550,height=500");
}
//-->
<!--
function click()
{
window.open("http://www.dontstop.co.uk/v2/atb/html_files/lyrics-melodies-9pmtillicome[134].htm","click2","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=550,height=136");
}
//-->
<!--
function click()
{
window.open("http://www.dontstop.co.uk/v2/atb/html_files/lyrics-melodies-dontstop[134].htm","click3","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no,width=550,height=136");
}
//-->
</SCRIPT>



great, i link as javascript:click(1); javascript:click(2); javascript:click(3); and so on, but the problem is - the same window ALWAYS opens... same size and everything??? what am i doing wrong? please help Sad
OfflineView User's ProfileFind all posts by GarySend Personal MessageVisit Poster's WebsiteMSN Messenger
php4ever
Junior WebHelper
Junior WebHelper


Joined: 10 Oct 2002
Posts: 49

PostPosted: Thu Mar 04, 2004 3:40 am (20 years, 1 month ago) Reply with QuoteBack to Top

The function just needed a little tweaking so here's the revised code and it works. Put the following javascript in the HEAD section or alternatively at the end of the BODY -- your choice.

<SCRIPT LANGUAGE="JavaScript">
<!--
function click(num)
{
var features = "width=550,height=136,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=no";
var theurl = "";
var hostetc = "http://www.dontstop.co.uk/v2/atb/html_files";
var thepath = new Array(3);
thepath[0] = "/lyrics-music-inlovewiththedj.htm";
thepath[1] = "/lyrics-melodies-9pmtillicome[134].htm";
thepath[2] = "/lyrics-melodies-dontstop[134].htm";

num--; // adjust num so will index into array properly
theurl = hostetc + thepath[num];
window.open(theurl,"nuwin",features);
}
//-->
</script>

Then in the BODY section you would call the function like this:

<a href="javascript: click(1);">click 1</a><BR>
<a href="javascript: click(2);">click 2</a><br>
<a href="javascript: click(3);">click 3</a><br>

Hope this helps.
OfflineView User's ProfileFind all posts by php4everSend Personal Message
Gary
Junior WebHelper
Junior WebHelper


Joined: 30 Apr 2003
Posts: 21
Location: the UK, Devon

PostPosted: Thu Mar 04, 2004 9:03 pm (20 years, 1 month ago) Reply with QuoteBack to Top

you guys are geniuses!!!


cheers guys!!! Cool
OfflineView User's ProfileFind all posts by GarySend Personal MessageVisit Poster's WebsiteMSN Messenger
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.110293 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme