jackerybakery Posted September 6, 2010 Share Posted September 6, 2010 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 More sharing options...
jeffman Posted September 6, 2010 Share Posted September 6, 2010 Yes. Please post the code. Link to comment Share on other sites More sharing options...
jackerybakery Posted September 6, 2010 Author Share Posted September 6, 2010 <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 More sharing options...
thescientist Posted September 6, 2010 Share Posted September 6, 2010 you should consider using CSS for this kind of stuff: onMouseOver="this.style.cursor='pointer';"are you checking for errors? Link to comment Share on other sites More sharing options...
jackerybakery Posted September 6, 2010 Author Share Posted September 6, 2010 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. Link to comment Share on other sites More sharing options...
jackerybakery Posted September 6, 2010 Author Share Posted September 6, 2010 I just realised that the error is actually the mouse cannot interact with the page at all, it cannot click on links or select text.Anyone have any ideas? Link to comment Share on other sites More sharing options...
jackerybakery Posted September 6, 2010 Author Share Posted September 6, 2010 Apologies, it is not to do with JavaScript at all, I am quite embarassed by how stupid this post has become.Sorry Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.