Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.
-
Koesper #1
creating new command, how to select entire sourcecode
(i posted this same question on the general discussion forum a couple of hours
ago, but this is a better place for it)
Hi,
I often have to do a lot of find-and-replace actions on sites i'm building,
and i want to put all of these standard actions in a custom command in
dreamweaver.
I've built a nice little gui, but i'm wrestling with the javascript, i've
tried expanding on the 'Change Case' tutorial file, but this file only changes
the values within a certain element.
What i want is that i can get the entire sourcecode of a html file into one
single variable, so i can work my magic on that variable, and then to put the
entire thing back into the file.
I've attached the sourcecode, as you can see i've stripped it of just about
anything i think i don't need until i get past the current problem.
Can anyone point me in the right direction?
thanx in advance,
Casper de Groot
the Netherlands
attached code:
// JavaScript Document
function commandButtons() {
return new Array("OK", "action()", "Cancel", "window.close()");
}
function action(){
//get the current sourcecode
var theDOM = dw.getDocumentDOM();
var theWholeDoc = theDOM.outerHTML;
alert (theWholeDoc); //show it
//change the sourcecode
theWholeDoc = "<html><body>this is the new sourcecode</body></html>";
//write it back to the file
theDOM.outerHTML = theWholeDoc;
//close the gui
window.close(); // close extension UI
}
Koesper Guest
-
Dislay mySql version from a SELECT command?
Is there a way to display the mySql version number from a SELECT command? I need to check on a server where I have limited access. Thanks -
Improve SELECT command
Dear MySQL-ians, I perform a SELECT on my database, but it takes over a minute for every run. I have to run it over 10000 times (with different... -
Select Entire datagrid Row when down & up key is pressed
Hi, How to make the entire row in datagrid to be selected by using Up & Down arrow key? Thanks Edward -
Creating PDF via "Get Entire Site" but not breaking long pages
Hello, I am using Acrobat v5 and need to generate pdf files from entire sites. Everything works smoothly except one thing. Vertically tall web... -
Command to Select Mask won't work in F-MX
Hello! I have a script I created and used in Fireworks 4, and have tried to use without success in MX. The script used a command that selected an... -
Phil #2
Re: creating new command, how to select entire sourcecode
> var theDOM = dw.getDocumentDOM();
Try this :> var theWholeDoc = theDOM.outerHTML;
var theDOM = dw.getDocumentDOM();
var theHTML = theDOM.getElementsByTagName('html')[0];
var theWholeDoc = theHTML.outerHTML;
alert (theWholeDoc); //show it
theWholeDoc = "<html><body>this is the new sourcecode</body></html>";
//write it back to the file
theHTML.outerHTML = theWholeDoc;
Phil Guest
-
Koesper #3
Re: creating new command, how to select entiresourcecode
Thanx, i got it up and running with your help.
Koesper Guest



Reply With Quote

