Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 19th, 2009, 07:38 AM
Registered User
 
Join Date: Mar 2009
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default Issue with document.getElementsById

Hi

I am facing an issue with document.getElementsById thru which i was trying to preview an image which I have placed in a sharepoint document librray on mouseover.The code is as follows


<span class="srch-Icon">
<img alt="n1" id="{concat('IMG_',$id)}" src="http://a2ms04866:3000/Pdfimage/_t/pd...Fsmall_gif.jpg" onmouseover ="javascript:cool1('{concat('IMG_',$id)}','{title} ')"/>

<script language="javascript">

function cool()
{
alert("hii");
}
function cool1(ImgName, Title)
{
alert(ImgName);
alert(Title);
var i=Title.indexOf(".");
var xcv=Title.substring(0,i);
var imagepath='http://a2ms04866:3000/Pdfimage/'+xcv+'.jpg';
alert(imagepath);
document.getElementsById(ImgName).src=imagepath;
//alert(imagepath);
}
</script>


The issue is with the last line of the code -document.getElementsById(ImgName).src=imagepath;
Please help in fixing this also let me know if we have any alternate solution in hand to have a preview popup kind of stuff.

Thanks
Jag
 
Old March 19th, 2009, 01:12 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 166
Thanks: 2
Thanked 33 Times in 33 Posts
Default

Fixed in Issue in getElementsById
 
Old April 20th, 2009, 07:07 AM
Authorized User
 
Join Date: Jun 2003
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

document.getElementById(ImgName).src=imagepath;

No "s" in Element

Earl
http://www.duckin4printing.com/
 
Old April 21st, 2009, 04:29 AM
Friend of Wrox
 
Join Date: Jun 2007
Posts: 477
Thanks: 10
Thanked 19 Times in 18 Posts
Default

Nice work. I'd also consider converting this to a DOM scripting (sometimes called unobtrusive scripting) solution. I much prefer to get all the Javascript out of my webpages and into an external .js file, because it makes your website MUCH easier to maintain down the road.
__________________
-------------------------

Whatever you can do or dream you can, begin it. Boldness has genius, power and magic in it. Begin it now.
-Johann von Goethe

When Two Hearts Race... Both Win.
-Dove Chocolate Wrapper

Chroniclemaster1, Founder of www.EarthChronicle.com
A Growing History of our Planet, by our Planet, for our Planet.





Similar Threads
Thread Thread Starter Forum Replies Last Post
opener.document davidph Javascript 2 May 26th, 2007 01:36 AM
Document(.....) Ma7T XSLT 1 August 2nd, 2005 06:32 AM
Document all pallone Javascript How-To 2 January 28th, 2005 01:37 PM
Words Document maha HTML Code Clinic 8 September 29th, 2004 03:08 AM
document.open() issue fs22 Javascript 8 September 16th, 2004 09:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.