Jump to content

Multiple Function Call


jackerybakery
 Share

Recommended Posts

Hello,I have a webpage which I would like to rely on 2 functions, one is called when the body loads and the other is called when the user clicks on a specific image. (So onClick and onLoad).However I find if I set the website to call the onLoad function, the onClick functions no longer work.I have tried with the functions called by 2 separate files, and also with both functions in the same file.Any ideas?Thanks Very Much :)(If you require the code just ask).

Link to comment
Share on other sites

<body onClick="genBottom(1060)">

<div class="contentArt">		<a class="art" onClick="imgPopup('arumLillies',703,550)" onMouseOver="this.style.cursor='pointer';"><img src="./images/arumLillies.jpg" /><br />Arum Lillies<br />36cm x 46cm</a>		<a class="art" onClick="imgPopup('redRose',372,550)" onMouseOver="this.style.cursor='pointer';"><img src="./images/redRose.jpg" /><br />Red Rose<br />30cm x 20cm</a>		<a class="art" onClick="imgPopup('furnivalsDaughter',407,551)" onMouseOver="this.style.cursor='pointer';"><img src="./images/furnivalsDaughter.jpg" /><br />Furnival's Daughter<br />37cm x 33cm</a><!-- etc -->

function genBottom(height)	{	if (navigator.appName == "Microsoft Internet Explorer")		{		var screenH = screen.availHeight - document.body.clientHeight - (screen.height - screen.availHeight);		}	else 		{		var screenH = window.innerHeight;		}		if (screenH > height){;}	else {document.body.style.height= height + "px";}	}

function imgPopup(img,width,height)	{	if (navigator.appName == "Microsoft Internet Explorer")		{		ieImgPop(img,width,height);		}	else		{		imgPop(img,width,height);		}	}

Is that OK? Thanks.

Link to comment
Share on other sites

you should consider using CSS for this kind of stuff:are you checking for errors?
Thanks for the tip about that, didn't know it was possible in CSS. Despite just realising that I was executing CSS in javascript! Silly error, sorry. Edited by jackerybakery
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...