Replacing images using Javascript
There are several posts explaining how to replace an image using Javascript (simpler with JQuery), but when I tried the code, the image kept reverting to the original image specified. This occurred regardless of browser, but does not revert in DW's "Live View". It turns out the culprit is that I was using an anchor <a> with a href attribute. The browser apparently evaluates the href after processing the OnClick() event. Switching to a button versus an anchor solved the problem. DW needs a little tuning.
It turns out the culprit is that I was using an anchor <a> with a href attribute. The browser apparently evaluates the href after processing the OnClick() event. Switching to a button versus an anchor solved the problem.
If you show us your code that wasn't working we'll be happy to recommend
Don't need to see code. The explanation was clear enough to determine the cause of issue. <a href="somefile.ext" onclick="somefunction();">click</a> is going to somefile.ext immediately after triggering the onclick event on the page. Lookup return false; for the solution of using onclick event in an anchor tag.
Similar Messages
-
Writing specialized metadata to image using Javascript...
I'm working on a project where we are dumping metadata from a database into a text file and then writing it to images using javascript. As long as I use the fields listed in the Javascript reference manual, it works perfectly.
However, the client has asked me to write specialized metadata. I created a panel for them to add in the extra fields. Is there a way to get Javascript to write the extra fields? (Is there a way to extend the DocumentInfo class in Javascript? Me thinks not...but I thought I'd ask.)
Thanks,
LauraI very interested in this as well... Found an answer yet? Seem silly to me that do don't have access to all of your tags...
-
Replacing images used as a link with background image
OK - I'm embarrassed to say that what I'm trying to do is
blindingly
obvious, and I've used Dw for several years - and do most of
the work
in code view but I'm having a senior moment and can't do what
I want.
I've read that when you use images on a page for background
styling,
for example the logo, or an image of a professional body such
as IEE,
it is more semantically correct to use CSS background images
rather
that a <img src=
tag
So I have a div in which I put the background, but then
perhaps quite
logically you can't directly put a link to it. So how do you
do it.
I've tried to ensure there was a block element so when you
hover l
mouse over it you get a block link - but no joy.
maybe my dyslexia early is the sign of premature brain fade
~Malcolm N....
~You cannot place a link on a background image. However, you
can place a
link on a transparent image floated over the background.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Malcolm N_" <[email protected]> wrote in message
news:[email protected]..
>
> OK - I'm embarrassed to say that what I'm trying to do
is blindingly
> obvious, and I've used Dw for several years - and do
most of the work
> in code view but I'm having a senior moment and can't do
what I want.
> !!!
>
> I've read that when you use images on a page for
background styling,
> for example the logo, or an image of a professional body
such as IEE,
> it is more semantically correct to use CSS background
images rather
> that a <img src=
> tag
>
> So I have a div in which I put the background, but then
perhaps quite
> logically you can't directly put a link to it. So how do
you do it.
>
> I've tried to ensure there was a block element so when
you hover l
> mouse over it you get a block link - but no joy.
>
> maybe my dyslexia early is the sign of premature brain
fade ;-)
>
> --
>
> ~Malcolm N....
> ~ -
I have been working on a project that requires a slide presentation consisting solely of a number of .psd images. While waiting for one final asset from the client, I decided to go ahead and throw together the presentation in Keynote, thinking I could just update the .psd images easily after I finished editing them with the final asset. However, to my dismay, I have learned that Keynote isn't intelligent in this regard to realize when I have updated assets used by it, nor does it give me any tools to accomplish the task of updating an image short of recreating the entire project.
Is there a way to batch replace images used by Keynote? This seems like an incredibly simple workflow task, but it seems there is no simple way to do it. I found one other thread that suggested looking at the package contents of my .key document, but that doesn't seem to work anymore - the option to view package contents doesn't show up on my context menu.
I'm going to go ahead and spend the hour recreating this document, but it would be nice to know the answer to this question for future reference! This is something I know even PowerPoint can accomplish... :/Welcome to the forums!
Keynote files are still packages, but the default behaviour for Keynote is to compress them as a ZIP file. If you change the file extension from .key to .zip, then uncompress the result, you will get a folder with the package contents, including the images. To make this back into a standard package, just add the .key extension to the folder (to get the compressed package, first compress the folder, then add the .key).
You can control whether a package is stored as a single compressed file or not in the Keynote Preferences. -
How to find the font and replace another font using javascript in illustrator?
Dear All,
how to find the font and replace another font using javascript [batch process] in illustrator?
i have 700 image file, it very deficult replace one by one.
regards,
.Suresh.SAsk the creator of the file for a unprotected version.
-
How to display Images stored in a database using javascript
Hi.
I have some images stored in a table and I need to display them using javascript. The images are stored in BLOB columns: I would like to know if I can put them on a directory and then get it from there using BFILENAME function.
Any suggestion?
Regards,
JeannineHi All,
Yes DuraiRaja - i am using the document.getElementById(' ').
In my app, I have a Main controller calling a View - Default.HTM,
This Default.HTM, in turn loads up three trays T1, T2, T3 and these tray elements in turn call up the controllers ctrl1, ctrl2, ctrl3 associated to them.
CTRL1 calls a view - View1 - V1.htm, which has the below code.
And on the below page all that i am trying to do is validate if "FieldVal" is blank or not.
I get an error on IE as "Object required"
I get a HTTP 501/505 error when i try to upload the code.
Thanks all ! -
I'm using Javascript to rotate background images -->
function rotateImages() {
setInterval("startRotator()", 7000);
var counter = 0;
function startRotator() {
var images = ["images/finance1.jpg","images/finance2.jpg","images/finance3.jpg","images/finance4.jpg","images/finance5.jpg","images/finance6.jpg"];
if( counter >= images.length ) {
counter = 0;
var image = "url('" + images[counter] + "')";
counter++;
document.body.style.backgroundImage=image;
The script is triggered by the load event when the homepage loads and the script only runs on the homepage. Everything works fine upon opening the homepage.
If I leave the home page and return, the images will have trouble loading for about 3 to 5 cycles and I'll get white backgrounds for part of the time. The same thing happens if I enter the site from a page other than the homepage and then go to the homepage.
I discovered, however, that if I enter the site at the homepage and then leave the homepage and return using the back button, everything runs fine. Apparently it then accesses a cached version of the homepage? Seems having two cached versions creates a conflict?
This problem only happens with Firefox (I have ver 29.0.1). It does not happen on IE ver 11, Chrome ver 34, or Safari ver 5.1.7.
I get the same problem with XP, Win7, and Win8 but, only on Firefox.
Can you please fix this?Hey, I am trying to reproduce this here: [http://jsfiddle.net/u3TLb/]
Mozillazine forums and the [http://webcompat.com] are more specialized in Web Compatibility, please ask there as well. -
How to get image properties in PDF using javascript or plug ins
Hi
How to get the image(all the images) properties in PDF using javascript or suggest plug ins
Thanks in AdvanceHI,
In the PDF Edit API's ( as has already been suggested) there is the PDEImage and using this you should be able to find out everything you need to know about any image in a PDF file.
I would recommend starting with PDEImageGetAttrs
Hope this helps
Malcolm -
The situation:
I want to use basetext font, but some of the glyphs are missing in it, and are highlighted with pink boxes. common font [stix, etc.] have much more glyphs than basetext font. I can apply common font [stix, etc.]manually for each of the missing glyphs or insert two character and use kerning set it up, but it is tedious.
Question:
How find the missing glyph using javascript [like indesign preflight], and replace same glyph available font or insert two character and use kerning set it up?
Any one know how to do this?
Thanks in Advance,
~JackTry Peter kehrl's script
http://www.kahrel.plus.com/indesign/missing_glyphs.jsx -
How to get image properties in PDF using javascript
Hi
How to get the image(all the images) properties in PDF using javascript?
Thanks in AdvanceHi
Thanks for your quick response. Any recommended plug ins
Thanks in advance -
Since the latest update to version 35, many sites that use javascript to manipulate images tend to crash firefox and make either the guilty tab or all of firefox close suddenly. (Firefox on Debian 7 Wheezy Linux, all updates current). I use firefox daily for web development and this regression bug is VERY annoying for my workflow. I understand you cannot take every situation into account. I do not have the time to investigate what has made Firefox less stable. I really hope you can fix this performance problem. If I can do anything concrete to help besides jumping into the code, let me know.
'''[https://addons.mozilla.org/en-US/firefox/addon/flashblock/ Flash block]''' {web link}
Never be annoyed by a Flash animation again! Blocks Flash so it
won't get in your way, but if you want to see it, just click on it
If you have problems with current Shockwave Flash plugin versions then check this:
* see if there are updates for your graphics drive drivers
'''https://support.mozilla.org/kb/upgrade-graphics-drivers-use-hardware-acceleration'''
* disable protected mode in the Flash plugin (Flash 11.3+ on Windows Vista and later)
'''https://forums.adobe.com/message/4468493#TemporaryWorkaround'''
* disable hardware acceleration in the Flash plugin
'''https://forums.adobe.com/thread/891337'''
See also:
* '''http://kb.mozillazine.org/Flash#Troubleshooting''' -
Resizing Image Window in Photoshop using Javascript
I write many scripts using the ScriptListener as my base for obtaining my scripts. One of the steps I need is to resize the Image window so I can properly place a logo on an image. When I resize the image using File>Automate>Fit Image. The Image Window shrinks down and I have to use Control 0 or Command 0 to resize the image window to be able to view a larger image on the screen to place the logo.
This is the Image Window Size after File>Automate>Fit Image
I need ot make the Image Window Larger using Control or Command 0
ScriptListener does not record this step of Control or Command 0.
Is there a script that anyone knows that does this?
It would be a great time saver if there was.
Thanks in advance for assisting me.
WorkflowMasterHi Workflowmaster,
Can you check the below mentioned script for your solution...
I think it can be works.......
- yajiv
Code :
Fit_ON_Screen();
function Fit_ON_Screen(){
var idslct = charIDToTypeID( "slct" );
var desc64 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref44 = new ActionReference();
var idMn = charIDToTypeID( "Mn " );
var idMnIt = charIDToTypeID( "MnIt" );
var idFtOn = charIDToTypeID( "FtOn" );
ref44.putEnumerated( idMn, idMnIt, idFtOn );
desc64.putReference( idnull, ref44 );
executeAction( idslct, desc64, DialogModes.ALL ); -
Script for replacing Image from a frame into InDesign document file
Hi All,
I am having an indesign document (indd) file with images and texts. I am using InDesign Server CS4 to run the scripts via SOAP.
My requirement is to replace any of the images from the required frame/s of indesign document through scripting (I already have frame id of which image needs to be replaced). I have written written java-script file (as given below): but when I execute this java-script on InDesign Server via SOAP, I get follwoing error into InDesign Server:
10/03/09 15:15:54 INFO [javascript] Executing File: \\Server_IP_Address\JavaScript_File_Path\JavaScript_File.js
10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/help.gif
10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/Documents%20and%20Settings/All%20Users/Documents/My%20Pictures/Sample%20Pictures/ Water%20lilies.jpg
10/03/09 15:16:01 ERROR [link manager] Link missing.; file:C:/Documents%20and%20Settings/All%20Users/Documents/My%20Pictures/Sample%20Pictures/ Winter.jpg
Following is the java-script that is being used for replacing image from indd's frame:
var myDocument = app.open(File('//Server_IP_Address/InDesignDocument_File_Path/Sample.indd'));
var tmp_frmid="1339"; //frame id of which image needs to be replaced.
for (var i=0;i<myDocument.pages.length;i++)
var objPage=myDocument.pages.item(i);
var objPageitems = objPage.pageItems;
try
var obj = objPageitems.itemByID(tmp_frmid);
obj.images[0].remove;
obj.appliedObjectStyle = null;
var myImage=obj.place(File('//Server_IP_Address/Images_to_be_reolaced_Path/ImageFile.jpg'));
var old_height = myImage.geometricBounds[2] - myImage.geometricBounds[0];
var new_height = obj.geometricBounds[2] - obj.geometricBounds[0];
var old_width = myImage.geometricBounds[3] - myImage.geometricBounds[1];
var new_width = obj.geometricBounds[1] + ((new_height / old_height) * old_width);
myImage.geometricBounds = [obj.geometricBounds[0] + "mm", obj.geometricBounds[1] + "mm", obj.geometricBounds[2] + "mm", new_width + "mm"];
var diff = obj.geometricBounds[1] - myImage.geometricBounds[1];
myImage.move( undefined, [diff,0] );
break;
catch(e)
myDocument.save('//Server_IP_Address/InDesignDocument_File_Path/Sample.indd');
var previewFile = File('//Server_IP_Address/Images_to_be_reolaced_Path/ImageFile.jpg');
app.jpegExportPreferences.jpegQuality["JPEGOptionsQuality.low"];
app.documents.item(0).exportFile(ExportFormat.jpg, previewFile);
myDocument.close();
I have very urgent requirement; if anyone have any idea; please suggest me. \
It would be highly appreciable.
Kind Regards,
Prashant.http://www.automatication.com/selection-to-pdf-script.html
Harbs
http://www.in-tools.com -
Hi,
I am trying to pre-load a few images on a page to save the loading time but seems to be not working in IE7. Here is my code:
<SCRIPT LANGUAGE="JavaScript">
top1 = new Image();
top1.src = "./1.jpg";
top1 = new Image();
top1.src = "./2.jpg";
</script>
This is declared in the HEAD section. But onmouseover still takes a second or two, but once loaded, mouseover is instant. I have an image name called top1, is it because i am loading the same object with 2 different images so will the first image not finish loading?
Also, if I was to include filenames which are dynamic, is there anything stopping me from using PHP code in the HEAD section? or is there a better way to do this?
Thanks in advance.What you are trying to do has very little to do with PHP, except the generation of the image names in the JavaScript. Once the web page is sent from the server, everything relies on JavaScript. I have created a simple demo on my website at http://foundationphp.com/test/preload.html.
The following script in the head of the page preloads the image:
<script type="text/javascript">
(new Image()).src = "/images/9781430210115.jpg";
</script>
In the body of the page, the rollover is created like this:
<p><img src="/images/9781430216100.jpg" width="130" height="160" alt="Book cover"
onmouseover="this.src='/images/9781430210115.jpg'"
onmouseout="this.src='/images/9781430216100.jpg'" /></p>
Note that the <img> tag has the original image assigned to its src attribute, and the replacement images are specified in the onmouseover and onmouseout event handlers. You cannot do it simply by assigning the preload image to a variable in the head and then assigning that variable name to the image, because the image tag has not been created at the time the script runs.
It sounds to me as though you want to rotate the images. If so, Google "JavaScript image rotator". You should find plenty of solutions. -
Can I use JavaScript to force objects to overlap a Web Object in Captivate 7?
Hi, so I have all of these great ideas for using Web Objects to enhance my courses, but am discouraged by the fact that I can't seem to get anything to overlap a Web Object. The only thing I can seem to get to overlap a Web Object is another Web Object. I have found that buttons seem to still work under the Web Object (which is good) but I really would like to know of a way to allow things on the Captivate timeline to be viewed on top of them. Things like text fields and images.
I've seen posts about how to use JavaScript to have the menu show above Web Objects, but that code doesn't seem to work for regular objects. I read that Web Objects sit in an "<iframe>" tag and that that forces it to appear above everything else. I'm left wondering if it is possible to get around this by somehow putting Captivate objects in an <iframe> of their own with JavaScript? Or is there some other way? Does anybody know any JavaScript I can apply to Captivate objects to get them to appear above a Web Object?
Thanks,
DanSo I have come to learn that the "<iframe>" tag for a Web Object is simply a window that sits on top of the course. Now I'm wondering if anyone has an effective method for importing flash quality animation (in whatever form) that can sit underneath of Captivate objects and still be HTML5 compliant?
Thanks,
Dan
Maybe you are looking for
-
My 30 pin dice silverline ipod kit in my car worked fine with my old iphone. it charged and played audio. I bought both 30 pin to lighting (cable and adapter) from Apple store but it does not charge. It only play audio. I have verified that both
-
Just got a new IPAD3, straight out of the box, but I cant charge it, I have tried with the power plug and cable out of the box that came with it but no joy, i have tried resetting the iPad but still no joy, have tried different mains plug sockets aro
-
Sender SOAP adapter: get soap header data
Hi, I've been going through various posts and blogs here on SDN + looked in the how to guide for SOAP adapter, but still find it quite difficult to actually find out how to do it. I've tried to follow recommendations seen, but it doesn't add up. So c
-
SD - DSD Connector Invoice Prices tables
Dear All I want to get invoices from DSD tables: I found this tables: /DSD/HH_RAHD = Tour /DSD/HH_RADELHD = Invoice Header /DSD/HH_RADELIT = Invoice Detail I want to get the price of every line item in these invoices (unit price, taxes, total). Thank
-
Difference between 2004 and 2004s
hi everybody, I had developed an application in 2004s,I am trying to deploy it in 2004 application server.I could not able to run the application .I am getting following Error. Cannot Resolve WDEventHandler. Is there any alternative